refactor: using unified nanoid (#4519)

This commit is contained in:
Alex Yang
2023-09-27 21:53:04 -05:00
committed by GitHub
parent 56f75160f3
commit 603f82ffc2
38 changed files with 258 additions and 183 deletions
@@ -1,5 +1,5 @@
import { uuidv4 } from '@blocksuite/store';
import { atom } from 'jotai';
import { nanoid } from 'nanoid';
export type Notification = {
key?: string;
@@ -42,7 +42,7 @@ export const removeNotificationAtom = atom(null, (_, set, key: string) => {
export const pushNotificationAtom = atom<null, [Notification], void>(
null,
(_, set, newNotification) => {
newNotification.key = newNotification.key || uuidv4();
newNotification.key = newNotification.key || nanoid();
const key = newNotification.key;
const removeNotification = () =>
set(notificationsBaseAtom, notifications =>
@@ -8,9 +8,9 @@ import {
RemoveIcon,
SaveIcon,
} from '@blocksuite/icons';
import { uuidv4 } from '@blocksuite/store';
import { Button } from '@toeverything/components/button';
import { Modal } from '@toeverything/components/modal';
import { nanoid } from 'nanoid';
import { useCallback, useMemo, useState } from 'react';
import { Input, ScrollableContainer } from '../../..';
@@ -280,7 +280,7 @@ export const SaveCollectionButton = ({
const handleClick = useCallback(() => {
changeShow(true);
setInit({
id: uuidv4(),
id: nanoid(),
name: '',
filterList,
workspaceId,