diff --git a/frontend/web/src/components/CreateCollectionDrawer.tsx b/frontend/web/src/components/CreateCollectionDrawer.tsx index c7a6fc0..18fc6e2 100644 --- a/frontend/web/src/components/CreateCollectionDrawer.tsx +++ b/frontend/web/src/components/CreateCollectionDrawer.tsx @@ -51,6 +51,13 @@ const CreateCollectionDrawer: React.FC = (props: Props) => { }) .filter((shortcut) => !selectedShortcuts.find((selectedShortcut) => selectedShortcut.id === shortcut.id)); + const setPartialState = (partialState: Partial) => { + setState({ + ...state, + ...partialState, + }); + }; + useEffect(() => { if (workspaceStore.setting.defaultVisibility !== Visibility.VISIBILITY_UNSPECIFIED) { setPartialState({ @@ -87,13 +94,6 @@ const CreateCollectionDrawer: React.FC = (props: Props) => { return null; } - const setPartialState = (partialState: Partial) => { - setState({ - ...state, - ...partialState, - }); - }; - const handleNameInputChange = (e: React.ChangeEvent) => { setPartialState({ collectionCreate: Object.assign(state.collectionCreate, { diff --git a/frontend/web/src/components/CreateShortcutDrawer.tsx b/frontend/web/src/components/CreateShortcutDrawer.tsx index e716f63..cd30cef 100644 --- a/frontend/web/src/components/CreateShortcutDrawer.tsx +++ b/frontend/web/src/components/CreateShortcutDrawer.tsx @@ -59,6 +59,13 @@ const CreateShortcutDrawer: React.FC = (props: Props) => { const loadingState = useLoading(!isCreating); const requestState = useLoading(false); + const setPartialState = (partialState: Partial) => { + setState({ + ...state, + ...partialState, + }); + }; + useEffect(() => { if (workspaceStore.setting.defaultVisibility !== Visibility.VISIBILITY_UNSPECIFIED) { setPartialState({ @@ -94,13 +101,6 @@ const CreateShortcutDrawer: React.FC = (props: Props) => { return null; } - const setPartialState = (partialState: Partial) => { - setState({ - ...state, - ...partialState, - }); - }; - const handleNameInputChange = (e: React.ChangeEvent) => { setPartialState({ shortcutCreate: Object.assign(state.shortcutCreate, {