refactor: ♻️ Migrate from short-uuid to cuid lib
This commit is contained in:
@@ -9,11 +9,11 @@ import { useStepDnd } from 'contexts/GraphDndContext'
|
||||
import { useTypebot } from 'contexts/TypebotContext/TypebotContext'
|
||||
import { headerHeight } from 'components/shared/TypebotHeader/TypebotHeader'
|
||||
import { DraggableStepType, PublicTypebot, Typebot } from 'models'
|
||||
import { generate } from 'short-uuid'
|
||||
import { AnswersCount } from 'services/analytics'
|
||||
import { useDebounce } from 'use-debounce'
|
||||
import { DraggableCore, DraggableData, DraggableEvent } from 'react-draggable'
|
||||
import GraphContent from './GraphContent'
|
||||
import cuid from 'cuid'
|
||||
|
||||
declare const window: { chrome: unknown | undefined }
|
||||
|
||||
@@ -81,7 +81,7 @@ export const Graph = ({
|
||||
x: e.clientX - graphPosition.x - blockWidth / 3,
|
||||
y: e.clientY - graphPosition.y - 20 - headerHeight,
|
||||
}
|
||||
const id = generate()
|
||||
const id = cuid()
|
||||
updateBlockCoordinates(id, coordinates)
|
||||
createBlock({
|
||||
id,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Box, Button, Fade, Flex, IconButton, Stack } from '@chakra-ui/react'
|
||||
import { TrashIcon, PlusIcon } from 'assets/icons'
|
||||
import cuid from 'cuid'
|
||||
import { dequal } from 'dequal'
|
||||
import { Draft } from 'immer'
|
||||
import React, { useEffect, useState } from 'react'
|
||||
import { generate } from 'short-uuid'
|
||||
import { useImmer } from 'use-immer'
|
||||
|
||||
type ItemWithId<T> = T & { id: string }
|
||||
@@ -42,7 +42,7 @@ export const TableList = <T,>({
|
||||
|
||||
const createItem = () => {
|
||||
setItems((items) => {
|
||||
const id = generate()
|
||||
const id = cuid()
|
||||
const newItem = { id } as Draft<ItemWithId<T>>
|
||||
items.push(newItem)
|
||||
})
|
||||
|
||||
@@ -12,9 +12,9 @@ import {
|
||||
} from '@chakra-ui/react'
|
||||
import { PlusIcon, TrashIcon } from 'assets/icons'
|
||||
import { useTypebot } from 'contexts/TypebotContext'
|
||||
import cuid from 'cuid'
|
||||
import { Variable } from 'models'
|
||||
import React, { useState, useRef, ChangeEvent, useEffect } from 'react'
|
||||
import { generate } from 'short-uuid'
|
||||
import { useDebounce } from 'use-debounce'
|
||||
import { byId, isNotDefined } from 'utils'
|
||||
|
||||
@@ -89,7 +89,7 @@ export const VariableSearchInput = ({
|
||||
|
||||
const handleCreateNewVariableClick = () => {
|
||||
if (!inputValue || inputValue === '') return
|
||||
const id = generate()
|
||||
const id = cuid()
|
||||
onSelectVariable({ id, name: inputValue })
|
||||
createVariable({ id, name: inputValue })
|
||||
onClose()
|
||||
|
||||
Reference in New Issue
Block a user