feat(ui): use useAssertSingleton for all singleton modals

footgun insurance
This commit is contained in:
psychedelicious
2024-10-10 13:41:25 +10:00
parent 99e88e601d
commit 69773a791d
13 changed files with 27 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
import { ConfirmationAlertDialog, Text } from '@invoke-ai/ui-library';
import { useStore } from '@nanostores/react';
import { useAssertSingleton } from 'common/hooks/useAssertSingleton';
import { toast } from 'features/toast/toast';
import { atom } from 'nanostores';
import { useCallback } from 'react';
@@ -19,6 +20,7 @@ export const useDeleteWorkflow = () => {
};
export const DeleteWorkflowDialog = () => {
useAssertSingleton('DeleteWorkflowDialog');
const { t } = useTranslation();
const workflowToDelete = useStore($workflowToDelete);
const [_deleteWorkflow] = useDeleteWorkflowMutation();

View File

@@ -1,5 +1,6 @@
import { ConfirmationAlertDialog, Flex, Text } from '@invoke-ai/ui-library';
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
import { useAssertSingleton } from 'common/hooks/useAssertSingleton';
import { buildUseDisclosure } from 'common/hooks/useBoolean';
import { nodeEditorReset } from 'features/nodes/store/nodesSlice';
import { selectWorkflowIsTouched, workflowModeChanged } from 'features/nodes/store/workflowSlice';
@@ -43,6 +44,7 @@ export const useNewWorkflow = () => {
};
export const NewWorkflowConfirmationAlertDialog = memo(() => {
useAssertSingleton('NewWorkflowConfirmationAlertDialog');
const { t } = useTranslation();
const dialog = useDialogState();
const newWorkflow = useNewWorkflow();