📦 Update cuid to cuid2

This commit is contained in:
Baptiste Arnaud
2023-02-10 15:06:02 +01:00
parent 2dbf0fb848
commit 51f76700b2
77 changed files with 254 additions and 250 deletions

View File

@@ -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])

View File

@@ -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()