Skip to content

Commit 3b381b5

Browse files
tidy(ui): remove the ToastID enum
With the model install logic cleaned up the enum is less useful
1 parent f2b9684 commit 3b381b5

File tree

6 files changed

+12
-24
lines changed

6 files changed

+12
-24
lines changed

invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/controlAdapterPreprocessor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
} from 'features/controlLayers/store/controlLayersSlice';
1515
import { CA_PROCESSOR_DATA } from 'features/controlLayers/util/controlAdapters';
1616
import { isImageOutput } from 'features/nodes/types/common';
17-
import { toast, ToastID } from 'features/toast/toast';
17+
import { toast } from 'features/toast/toast';
1818
import { t } from 'i18next';
1919
import { isEqual } from 'lodash-es';
2020
import { getImageDTO } from 'services/api/endpoints/images';
@@ -175,7 +175,7 @@ export const addControlAdapterPreprocessor = (startAppListening: AppStartListeni
175175
}
176176

177177
toast({
178-
id: ToastID.GRAPH_QUEUE_FAILED,
178+
id: 'GRAPH_QUEUE_FAILED',
179179
title: t('queue.graphFailedToQueue'),
180180
status: 'error',
181181
});

invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/controlNetImageProcessed.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
} from 'features/controlAdapters/store/controlAdaptersSlice';
1111
import { isControlNetOrT2IAdapter } from 'features/controlAdapters/store/types';
1212
import { isImageOutput } from 'features/nodes/types/common';
13-
import { toast, ToastID } from 'features/toast/toast';
13+
import { toast } from 'features/toast/toast';
1414
import { t } from 'i18next';
1515
import { imagesApi } from 'services/api/endpoints/images';
1616
import { queueApi } from 'services/api/endpoints/queue';
@@ -109,7 +109,7 @@ export const addControlNetImageProcessedListener = (startAppListening: AppStartL
109109
}
110110

111111
toast({
112-
id: ToastID.GRAPH_QUEUE_FAILED,
112+
id: 'GRAPH_QUEUE_FAILED',
113113
title: t('queue.graphFailedToQueue'),
114114
status: 'error',
115115
});

invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/setDefaultSettings.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
isParameterWidth,
2020
zParameterVAEModel,
2121
} from 'features/parameters/types/parameterSchemas';
22-
import { toast, ToastID } from 'features/toast/toast';
22+
import { toast } from 'features/toast/toast';
2323
import { t } from 'i18next';
2424
import { modelConfigsAdapterSelectors, modelsApi } from 'services/api/endpoints/models';
2525
import { isNonRefinerMainModelConfig } from 'services/api/types';
@@ -108,7 +108,7 @@ export const addSetDefaultSettingsListener = (startAppListening: AppStartListeni
108108
}
109109
}
110110

111-
toast({ id: ToastID.PARAMETER_SET, title: t('toast.parameterSet', { parameter: 'Default settings' }) });
111+
toast({ id: 'PARAMETER_SET', title: t('toast.parameterSet', { parameter: 'Default settings' }) });
112112
}
113113
},
114114
});

invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/upscaleRequested.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'
44
import { parseify } from 'common/util/serialize';
55
import { buildAdHocUpscaleGraph } from 'features/nodes/util/graph/buildAdHocUpscaleGraph';
66
import { createIsAllowedToUpscaleSelector } from 'features/parameters/hooks/useIsAllowedToUpscale';
7-
import { toast, ToastID } from 'features/toast/toast';
7+
import { toast } from 'features/toast/toast';
88
import { t } from 'i18next';
99
import { queueApi } from 'services/api/endpoints/queue';
1010
import type { BatchConfig, ImageDTO } from 'services/api/types';
@@ -65,7 +65,7 @@ export const addUpscaleRequestedListener = (startAppListening: AppStartListening
6565
return;
6666
} else {
6767
toast({
68-
id: ToastID.GRAPH_QUEUE_FAILED,
68+
id: 'GRAPH_QUEUE_FAILED',
6969
title: t('queue.graphFailedToQueue'),
7070
status: 'error',
7171
});

invokeai/frontend/web/src/features/metadata/util/handlers.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import type {
1414
import { fetchModelConfig } from 'features/metadata/util/modelFetchingHelpers';
1515
import { validators } from 'features/metadata/util/validators';
1616
import type { ModelIdentifierField } from 'features/nodes/types/common';
17-
import { toast, ToastID } from 'features/toast/toast';
17+
import { toast } from 'features/toast/toast';
1818
import { t } from 'i18next';
1919
import { assert } from 'tsafe';
2020

@@ -91,7 +91,7 @@ const renderLayersValue: MetadataRenderValueFunc<Layer[]> = async (layers) => {
9191

9292
const parameterSetToast = (parameter: string) => {
9393
toast({
94-
id: ToastID.PARAMETER_SET,
94+
id: 'PARAMETER_SET',
9595
title: t('toast.parameterSet'),
9696
description: t('toast.parameterSetDesc', { parameter }),
9797
status: 'info',
@@ -461,13 +461,13 @@ export const parseAndRecallAllMetadata = async (
461461

462462
if (results.some((result) => result.status === 'fulfilled')) {
463463
toast({
464-
id: ToastID.PARAMETER_SET,
464+
id: 'PARAMETER_SET',
465465
title: t('toast.parametersSet'),
466466
status: 'info',
467467
});
468468
} else {
469469
toast({
470-
id: ToastID.PARAMETER_SET,
470+
id: 'PARAMETER_SET',
471471
title: t('toast.parametersNotSet'),
472472
status: 'warning',
473473
});

invokeai/frontend/web/src/features/toast/toast.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import type { UseToastOptions } from '@invoke-ai/ui-library';
22
import { createStandaloneToast, theme, TOAST_OPTIONS } from '@invoke-ai/ui-library';
33
import { map } from 'nanostores';
4-
import { z } from 'zod';
54

65
const toastApi = createStandaloneToast({
76
theme: theme,
@@ -99,14 +98,3 @@ const parseConfig = (id: string, arg: ToastArg, count: number): ToastConfig => {
9998
};
10099
return { ...arg, title, onCloseComplete };
101100
};
102-
103-
/**
104-
* Enum of toast IDs that are often shared between multiple components (typo insurance)
105-
*/
106-
export const ToastID = z.enum([
107-
'MODEL_INSTALL_QUEUED',
108-
'MODEL_INSTALL_QUEUE_FAILED',
109-
'GRAPH_QUEUE_FAILED',
110-
'PARAMETER_SET',
111-
'PARAMETER_NOT_SET',
112-
]).enum;

0 commit comments

Comments
 (0)