📦 Update cuid to cuid2
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { Box, Button, Fade, Flex, IconButton, Stack } from '@chakra-ui/react'
|
||||
import { TrashIcon, PlusIcon } from '@/components/icons'
|
||||
import cuid from 'cuid'
|
||||
import { createId } from '@paralleldrive/cuid2'
|
||||
import React, { useState } from 'react'
|
||||
|
||||
type ItemWithId<T> = T & { id: string }
|
||||
@@ -32,7 +32,7 @@ export const TableList = <T,>({
|
||||
const [showDeleteIndex, setShowDeleteIndex] = useState<number | null>(null)
|
||||
|
||||
const createItem = () => {
|
||||
const id = cuid()
|
||||
const id = createId()
|
||||
const newItem = { id } as ItemWithId<T>
|
||||
setItems([...items, newItem])
|
||||
onItemsChange([...items, newItem])
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
} from '@chakra-ui/react'
|
||||
import { EditIcon, PlusIcon, TrashIcon } from '@/components/icons'
|
||||
import { useTypebot } from '@/features/editor/providers/TypebotProvider/TypebotProvider'
|
||||
import cuid from 'cuid'
|
||||
import { createId } from '@paralleldrive/cuid2'
|
||||
import { Variable } from 'models'
|
||||
import React, { useState, useRef, ChangeEvent, useEffect } from 'react'
|
||||
import { byId, isDefined, isNotDefined } from 'utils'
|
||||
@@ -90,7 +90,7 @@ export const VariableSearchInput = ({
|
||||
|
||||
const handleCreateNewVariableClick = () => {
|
||||
if (!inputValue || inputValue === '') return
|
||||
const id = 'v' + cuid()
|
||||
const id = 'v' + createId()
|
||||
onSelectVariable({ id, name: inputValue })
|
||||
createVariable({ id, name: inputValue })
|
||||
inputRef.current?.blur()
|
||||
|
||||
Reference in New Issue
Block a user