diff --git a/invokeai/frontend/web/scripts/typegen.js b/invokeai/frontend/web/scripts/typegen.js index c57e855b2e..7b3a747285 100644 --- a/invokeai/frontend/web/scripts/typegen.js +++ b/invokeai/frontend/web/scripts/typegen.js @@ -38,7 +38,7 @@ async function generateTypes(schema) { process.stdout.write(`\nOK!\r\n`); } -async function main() { +function main() { const encoding = 'utf-8'; if (process.stdin.isTTY) { diff --git a/invokeai/frontend/web/src/app/components/App.tsx b/invokeai/frontend/web/src/app/components/App.tsx index 5955e722c0..af3e0e4524 100644 --- a/invokeai/frontend/web/src/app/components/App.tsx +++ b/invokeai/frontend/web/src/app/components/App.tsx @@ -18,8 +18,8 @@ import { StylePresetModal } from 'features/stylePresets/components/StylePresetFo import { configChanged } from 'features/system/store/configSlice'; import { languageSelector } from 'features/system/store/systemSelectors'; import { AppContent } from 'features/ui/components/AppContent'; -import type { TabName } from "features/ui/store/uiTypes"; import { setActiveTab } from 'features/ui/store/uiSlice'; +import type { TabName } from "features/ui/store/uiTypes"; import { useGetAndLoadLibraryWorkflow } from 'features/workflowLibrary/hooks/useGetAndLoadLibraryWorkflow'; import { AnimatePresence } from 'framer-motion'; import i18n from 'i18n'; diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/addArchivedOrDeletedBoardListener.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/addArchivedOrDeletedBoardListener.ts index 23d3cbc9af..0972df0679 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/addArchivedOrDeletedBoardListener.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/addArchivedOrDeletedBoardListener.ts @@ -23,7 +23,7 @@ export const addArchivedOrDeletedBoardListener = (startAppListening: AppStartLis */ startAppListening({ matcher: matchAnyBoardDeleted, - effect: async (action, { dispatch, getState }) => { + effect: (action, { dispatch, getState }) => { const state = getState(); const deletedBoardId = action.meta.arg.originalArgs; const { autoAddBoardId, selectedBoardId } = state.gallery; @@ -44,7 +44,7 @@ export const addArchivedOrDeletedBoardListener = (startAppListening: AppStartLis // If we archived a board, it may end up hidden. If it's selected or the auto-add board, we should reset those. startAppListening({ matcher: boardsApi.endpoints.updateBoard.matchFulfilled, - effect: async (action, { dispatch, getState }) => { + effect: (action, { dispatch, getState }) => { const state = getState(); const { shouldShowArchivedBoards } = state.gallery; @@ -61,7 +61,7 @@ export const addArchivedOrDeletedBoardListener = (startAppListening: AppStartLis // When we hide archived boards, if the selected or the auto-add board is archived, we should reset those. startAppListening({ actionCreator: shouldShowArchivedBoardsChanged, - effect: async (action, { dispatch, getState }) => { + effect: (action, { dispatch, getState }) => { const shouldShowArchivedBoards = action.payload; // We only need to take action if we have just hidden archived boards. @@ -100,7 +100,7 @@ export const addArchivedOrDeletedBoardListener = (startAppListening: AppStartLis */ startAppListening({ matcher: boardsApi.endpoints.listAllBoards.matchFulfilled, - effect: async (action, { dispatch, getState }) => { + effect: (action, { dispatch, getState }) => { const boards = action.payload; const state = getState(); const { selectedBoardId, autoAddBoardId } = state.gallery; diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/anyEnqueued.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/anyEnqueued.ts index 373fa3dd28..b312005ef6 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/anyEnqueued.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/anyEnqueued.ts @@ -4,7 +4,7 @@ import { queueApi, selectQueueStatus } from 'services/api/endpoints/queue'; export const addAnyEnqueuedListener = (startAppListening: AppStartListening) => { startAppListening({ matcher: queueApi.endpoints.enqueueBatch.matchFulfilled, - effect: async (_, { dispatch, getState }) => { + effect: (_, { dispatch, getState }) => { const { data } = selectQueueStatus(getState()); if (!data || data.processor.is_started) { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/appConfigReceived.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/appConfigReceived.ts index 023bf73bc5..8104321ac6 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/appConfigReceived.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/appConfigReceived.ts @@ -6,7 +6,7 @@ import { appInfoApi } from 'services/api/endpoints/appInfo'; export const addAppConfigReceivedListener = (startAppListening: AppStartListening) => { startAppListening({ matcher: appInfoApi.endpoints.getAppConfig.matchFulfilled, - effect: async (action, { getState, dispatch }) => { + effect: (action, { getState, dispatch }) => { const { infill_methods = [], nsfw_methods = [], watermarking_methods = [] } = action.payload; const infillMethod = getState().canvasV2.compositing.infillMethod; diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/appStarted.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/appStarted.ts index 729067ee82..60a5310fcd 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/appStarted.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/appStarted.ts @@ -6,7 +6,7 @@ export const appStarted = createAction('app/appStarted'); export const addAppStartedListener = (startAppListening: AppStartListening) => { startAppListening({ actionCreator: appStarted, - effect: async (action, { unsubscribe, cancelActiveListeners }) => { + effect: (action, { unsubscribe, cancelActiveListeners }) => { // this should only run once cancelActiveListeners(); unsubscribe(); diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/galleryImageClicked.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/galleryImageClicked.ts index a77c260985..5271d655d9 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/galleryImageClicked.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/galleryImageClicked.ts @@ -27,7 +27,7 @@ export const galleryImageClicked = createAction<{ export const addGalleryImageClickedListener = (startAppListening: AppStartListening) => { startAppListening({ actionCreator: galleryImageClicked, - effect: async (action, { dispatch, getState }) => { + effect: (action, { dispatch, getState }) => { const { imageDTO, shiftKey, ctrlKey, metaKey, altKey } = action.payload; const state = getState(); const queryArgs = selectListImagesQueryArgs(state); diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imageToDeleteSelected.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imageToDeleteSelected.ts index 2e20d97b46..2766471188 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imageToDeleteSelected.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imageToDeleteSelected.ts @@ -6,7 +6,7 @@ import { imagesToDeleteSelected, isModalOpenChanged } from 'features/deleteImage export const addImageToDeleteSelectedListener = (startAppListening: AppStartListening) => { startAppListening({ actionCreator: imagesToDeleteSelected, - effect: async (action, { dispatch, getState }) => { + effect: (action, { dispatch, getState }) => { const imageDTOs = action.payload; const state = getState(); const { shouldConfirmOnDelete } = state.system; diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imagesStarred.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imagesStarred.ts index 74b36e3297..0337b995f5 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imagesStarred.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imagesStarred.ts @@ -6,7 +6,7 @@ import type { ImageDTO } from 'services/api/types'; export const addImagesStarredListener = (startAppListening: AppStartListening) => { startAppListening({ matcher: imagesApi.endpoints.starImages.matchFulfilled, - effect: async (action, { dispatch, getState }) => { + effect: (action, { dispatch, getState }) => { const { updated_image_names: starredImages } = action.payload; const state = getState(); diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imagesUnstarred.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imagesUnstarred.ts index ebae7885c1..ad6c26fd0c 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imagesUnstarred.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imagesUnstarred.ts @@ -6,7 +6,7 @@ import type { ImageDTO } from 'services/api/types'; export const addImagesUnstarredListener = (startAppListening: AppStartListening) => { startAppListening({ matcher: imagesApi.endpoints.unstarImages.matchFulfilled, - effect: async (action, { dispatch, getState }) => { + effect: (action, { dispatch, getState }) => { const { updated_image_names: unstarredImages } = action.payload; const state = getState(); diff --git a/invokeai/frontend/web/src/common/hooks/useFullscreenDropzone.ts b/invokeai/frontend/web/src/common/hooks/useFullscreenDropzone.ts index 76b9c0dcaf..9c84e66bfc 100644 --- a/invokeai/frontend/web/src/common/hooks/useFullscreenDropzone.ts +++ b/invokeai/frontend/web/src/common/hooks/useFullscreenDropzone.ts @@ -46,7 +46,7 @@ export const useFullscreenDropzone = () => { ); const fileAcceptedCallback = useCallback( - async (file: File) => { + (file: File) => { uploadImage({ file, image_category: 'user', @@ -96,7 +96,7 @@ export const useFullscreenDropzone = () => { useEffect(() => { // This is a hack to allow pasting images into the uploader - const handlePaste = async (e: ClipboardEvent) => { + const handlePaste = (e: ClipboardEvent) => { if (!dropzone.inputRef.current) { return; } diff --git a/invokeai/frontend/web/src/common/util/convertImageUrlToBlob.ts b/invokeai/frontend/web/src/common/util/convertImageUrlToBlob.ts index 44062fa025..16558533e1 100644 --- a/invokeai/frontend/web/src/common/util/convertImageUrlToBlob.ts +++ b/invokeai/frontend/web/src/common/util/convertImageUrlToBlob.ts @@ -7,7 +7,7 @@ import { $authToken } from 'app/store/nanostores/authToken'; * @returns A function that takes a URL and returns a Promise that resolves with a Blob */ -export const convertImageUrlToBlob = async (url: string) => +export const convertImageUrlToBlob = (url: string) => new Promise((resolve, reject) => { const img = new Image(); img.onload = () => { diff --git a/invokeai/frontend/web/src/features/controlLayers/components/CanvasResizer.tsx b/invokeai/frontend/web/src/features/controlLayers/components/CanvasResizer.tsx index 1d11a3d311..dbd44fd964 100644 --- a/invokeai/frontend/web/src/features/controlLayers/components/CanvasResizer.tsx +++ b/invokeai/frontend/web/src/features/controlLayers/components/CanvasResizer.tsx @@ -1,5 +1,4 @@ import { Flex, Grid, GridItem, IconButton } from '@invoke-ai/ui-library'; -import { useAppSelector } from 'app/store/storeHooks'; import { memo, useCallback, useState } from 'react'; import { PiArrowDownBold, @@ -25,7 +24,6 @@ type ResizeDirection = | 'down-right'; export const CanvasResizer = memo(() => { - const bbox = useAppSelector((s) => s.canvasV2.bbox); const [resizeDirection, setResizeDirection] = useState('center-out'); const setDirUpLeft = useCallback(() => { diff --git a/invokeai/frontend/web/src/features/controlLayers/components/ControlLayersToolbar.tsx b/invokeai/frontend/web/src/features/controlLayers/components/ControlLayersToolbar.tsx index a82f2da707..26df1cf1d8 100644 --- a/invokeai/frontend/web/src/features/controlLayers/components/ControlLayersToolbar.tsx +++ b/invokeai/frontend/web/src/features/controlLayers/components/ControlLayersToolbar.tsx @@ -10,17 +10,16 @@ import { ToolChooser } from 'features/controlLayers/components/Tool/ToolChooser' import { ToolEraserWidth } from 'features/controlLayers/components/Tool/ToolEraserWidth'; import { ToolFillColorPicker } from 'features/controlLayers/components/Tool/ToolFillColorPicker'; import { UndoRedoButtonGroup } from 'features/controlLayers/components/UndoRedoButtonGroup'; -import { CanvasManagerProviderGate, useCanvasManager } from 'features/controlLayers/contexts/CanvasManagerProviderGate'; +import { CanvasManagerProviderGate } from 'features/controlLayers/contexts/CanvasManagerProviderGate'; import { ToggleProgressButton } from 'features/gallery/components/ImageViewer/ToggleProgressButton'; import { ViewerToggleMenu } from 'features/gallery/components/ImageViewer/ViewerToggleMenu'; -import { memo, useSyncExternalStore } from 'react'; +import { memo } from 'react'; export const ControlLayersToolbar = memo(() => { const tool = useAppSelector((s) => s.canvasV2.tool.selected); return ( - @@ -41,15 +40,3 @@ export const ControlLayersToolbar = memo(() => { }); ControlLayersToolbar.displayName = 'ControlLayersToolbar'; - -const ReactiveTest = () => { - const canvasManager = useCanvasManager(); - const adapters = useSyncExternalStore( - canvasManager.adapters.rasterLayers.subscribe, - canvasManager.adapters.rasterLayers.getSnapshot - ); - - console.log(adapters); - - return null; -}; diff --git a/invokeai/frontend/web/src/features/controlLayers/components/StageComponent.tsx b/invokeai/frontend/web/src/features/controlLayers/components/StageComponent.tsx index 48a1dbc9f0..1502491e73 100644 --- a/invokeai/frontend/web/src/features/controlLayers/components/StageComponent.tsx +++ b/invokeai/frontend/web/src/features/controlLayers/components/StageComponent.tsx @@ -38,7 +38,6 @@ const useStageRenderer = (stage: Konva.Stage, container: HTMLDivElement | null, } const manager = new CanvasManager(stage, container, store, socket); - console.log(manager); const cleanup = manager.initialize(); return cleanup; }, [asPreview, container, socket, stage, store]); diff --git a/invokeai/frontend/web/src/features/controlLayers/konva/CanvasManager.ts b/invokeai/frontend/web/src/features/controlLayers/konva/CanvasManager.ts index d07730df75..c033165435 100644 --- a/invokeai/frontend/web/src/features/controlLayers/konva/CanvasManager.ts +++ b/invokeai/frontend/web/src/features/controlLayers/konva/CanvasManager.ts @@ -2,6 +2,7 @@ import type { AppSocket } from 'app/hooks/useSocketIO'; import { logger } from 'app/logging/logger'; import type { AppStore } from 'app/store/store'; import type { SerializableObject } from 'common/types'; +import { SyncableMap } from 'common/util/SyncableMap/SyncableMap'; import { CanvasCacheModule } from 'features/controlLayers/konva/CanvasCacheModule'; import { CanvasCompositorModule } from 'features/controlLayers/konva/CanvasCompositorModule'; import { CanvasFilterModule } from 'features/controlLayers/konva/CanvasFilterModule'; @@ -9,7 +10,6 @@ import { CanvasRenderingModule } from 'features/controlLayers/konva/CanvasRender import { CanvasStageModule } from 'features/controlLayers/konva/CanvasStageModule'; import { CanvasWorkerModule } from 'features/controlLayers/konva/CanvasWorkerModule.js'; import { getPrefixedId } from 'features/controlLayers/konva/util'; -import { SyncableMap } from 'common/util/SyncableMap/SyncableMap'; import type Konva from 'konva'; import { atom } from 'nanostores'; import type { Logger } from 'roarr'; diff --git a/invokeai/frontend/web/src/features/controlLayers/store/types.test.ts b/invokeai/frontend/web/src/features/controlLayers/store/types.test.ts index 9ee2dd975c..0e5e8c4b69 100644 --- a/invokeai/frontend/web/src/features/controlLayers/store/types.test.ts +++ b/invokeai/frontend/web/src/features/controlLayers/store/types.test.ts @@ -12,6 +12,8 @@ import type { DepthAnythingModelSize, DepthAnythingProcessorConfig, DWOpenposeProcessorConfig, + FilterConfig, + FilterType, HedProcessorConfig, IPMethodV2, LineartAnimeProcessorConfig, @@ -21,8 +23,6 @@ import type { MlsdProcessorConfig, NormalbaeProcessorConfig, PidiProcessorConfig, - FilterConfig, - FilterType, ZoeDepthProcessorConfig, } from './types'; diff --git a/invokeai/frontend/web/src/features/gallery/hooks/useGalleryHotkeys.ts b/invokeai/frontend/web/src/features/gallery/hooks/useGalleryHotkeys.ts index 81a5f34987..b8e9ed5b7e 100644 --- a/invokeai/frontend/web/src/features/gallery/hooks/useGalleryHotkeys.ts +++ b/invokeai/frontend/web/src/features/gallery/hooks/useGalleryHotkeys.ts @@ -1,7 +1,7 @@ import { useStore } from '@nanostores/react'; import { useAppSelector } from 'app/store/storeHooks'; -import { useAssertSingleton } from 'common/hooks/useAssertSingleton'; import { $activeScopes } from 'common/hooks/interactionScopes'; +import { useAssertSingleton } from 'common/hooks/useAssertSingleton'; import { useGalleryNavigation } from 'features/gallery/hooks/useGalleryNavigation'; import { useGalleryPagination } from 'features/gallery/hooks/useGalleryPagination'; import { selectListImagesQueryArgs } from 'features/gallery/store/gallerySelectors'; diff --git a/invokeai/frontend/web/src/features/metadata/util/handlers.ts b/invokeai/frontend/web/src/features/metadata/util/handlers.ts index 6bea34438b..12d8af35a9 100644 --- a/invokeai/frontend/web/src/features/metadata/util/handlers.ts +++ b/invokeai/frontend/web/src/features/metadata/util/handlers.ts @@ -48,7 +48,7 @@ const renderControlAdapterValue: MetadataRenderValueFunc = async (layer) => { +const renderLayerValue: MetadataRenderValueFunc = (layer) => { if (layer.type === 'initial_image_layer') { let rendered = t('controlLayers.globalInitialImageLayer'); if (layer.image) { @@ -88,7 +88,7 @@ const renderLayerValue: MetadataRenderValueFunc = async } assert(false, 'Unknown layer type'); }; -const renderLayersValue: MetadataRenderValueFunc = async (layers) => { +const renderLayersValue: MetadataRenderValueFunc = (layers) => { return `${layers.length} ${t('controlLayers.layers', { count: layers.length })}`; }; @@ -178,7 +178,10 @@ const buildRecallItem = } }; -const resolveToString = (value: unknown) => new Promise((resolve) => resolve(String(value))); +const resolveToString = (value: unknown) => + new Promise((resolve) => { + resolve(String(value)); + }); const buildHandlers: BuildMetadataHandlers = ({ getLabel, @@ -395,7 +398,7 @@ export const parseAndRecallPrompts = async (metadata: unknown) => { } }; -export const parseAndRecallImageDimensions = async (metadata: unknown) => { +export const parseAndRecallImageDimensions = (metadata: unknown) => { const recalled = recallKeys(['width', 'height'], metadata); if (size(recalled) > 0) { parameterSetToast(t('metadata.imageDimensions')); diff --git a/invokeai/frontend/web/src/features/metadata/util/parsers.ts b/invokeai/frontend/web/src/features/metadata/util/parsers.ts index 479add2e99..5c6831d9f7 100644 --- a/invokeai/frontend/web/src/features/metadata/util/parsers.ts +++ b/invokeai/frontend/web/src/features/metadata/util/parsers.ts @@ -1,6 +1,11 @@ import { getCAId, getImageObjectId, getIPAId, getLayerId } from 'features/controlLayers/konva/naming'; import { defaultLoRAConfig } from 'features/controlLayers/store/lorasReducers'; -import type { CanvasControlAdapterState, CanvasIPAdapterState, CanvasRasterLayerState, LoRA } from 'features/controlLayers/store/types'; +import type { + CanvasControlAdapterState, + CanvasIPAdapterState, + CanvasRasterLayerState, + LoRA, +} from 'features/controlLayers/store/types'; import { IMAGE_FILTERS, imageDTOToImageWithDims, @@ -424,7 +429,8 @@ const parseAllIPAdapters: MetadataParseFunc = async ( }; //#region Control Layers -const parseLayer: MetadataParseFunc = async (metadataItem) => zCanvasRasterLayerState.parseAsync(metadataItem); +const parseLayer: MetadataParseFunc = (metadataItem) => + zCanvasRasterLayerState.parseAsync(metadataItem); const parseLayers: MetadataParseFunc = async (metadata) => { // We need to support recalling pre-Control Layers metadata into Control Layers. A separate set of parsers handles @@ -559,9 +565,7 @@ const parseControlNetToControlAdapterLayer: MetadataParseFunc = (ipAdapt }); }; -const recallCA: MetadataRecallFunc = async (ca) => { - const { dispatch } = getStore(); - const clone = deepClone(ca); - if (clone.image) { - const imageDTO = await getImageDTO(clone.image.name); - if (!imageDTO) { - clone.image = null; - } - } - if (clone.processedImage) { - const imageDTO = await getImageDTO(clone.processedImage.name); - if (!imageDTO) { - clone.processedImage = null; - } - } - if (clone.model) { - try { - await fetchModelConfigByIdentifier(clone.model); - } catch { - // MODEL SMITED! - clone.model = null; - } - } - // No clobber - clone.id = getCAId(uuidv4()); - // dispatch(caRecalled({ data: clone })); - return; -}; +// const recallCA: MetadataRecallFunc = async (ca) => { +// const { dispatch } = getStore(); +// const clone = deepClone(ca); +// if (clone.image) { +// const imageDTO = await getImageDTO(clone.image.name); +// if (!imageDTO) { +// clone.image = null; +// } +// } +// if (clone.processedImage) { +// const imageDTO = await getImageDTO(clone.processedImage.name); +// if (!imageDTO) { +// clone.processedImage = null; +// } +// } +// if (clone.model) { +// try { +// await fetchModelConfigByIdentifier(clone.model); +// } catch { +// // MODEL SMITED! +// clone.model = null; +// } +// } +// // No clobber +// clone.id = getCAId(uuidv4()); +// // dispatch(caRecalled({ data: clone })); +// return; +// }; -const recallIPA: MetadataRecallFunc = async (ipa) => { - const { dispatch } = getStore(); - const clone = deepClone(ipa); - if (clone.imageObject) { - const imageDTO = await getImageDTO(clone.imageObject.name); - if (!imageDTO) { - clone.imageObject = null; - } - } - if (clone.model) { - try { - await fetchModelConfigByIdentifier(clone.model); - } catch { - // MODEL SMITED! - clone.model = null; - } - } - // No clobber - clone.id = getIPAId(uuidv4()); - dispatch(ipaRecalled({ data: clone })); - return; -}; +// const recallIPA: MetadataRecallFunc = async (ipa) => { +// const { dispatch } = getStore(); +// const clone = deepClone(ipa); +// if (clone.imageObject) { +// const imageDTO = await getImageDTO(clone.imageObject.name); +// if (!imageDTO) { +// clone.imageObject = null; +// } +// } +// if (clone.model) { +// try { +// await fetchModelConfigByIdentifier(clone.model); +// } catch { +// // MODEL SMITED! +// clone.model = null; +// } +// } +// // No clobber +// clone.id = getIPAId(uuidv4()); +// dispatch(ipaRecalled({ data: clone })); +// return; +// }; -const recallRG: MetadataRecallFunc = async (rg) => { - const { dispatch } = getStore(); - const clone = deepClone(rg); - // Strip out the uploaded mask image property - this is an intermediate image - clone.imageCache = null; +// const recallRG: MetadataRecallFunc = async (rg) => { +// const { dispatch } = getStore(); +// const clone = deepClone(rg); +// // Strip out the uploaded mask image property - this is an intermediate image +// clone.imageCache = null; - for (const ipAdapter of clone.ipAdapters) { - if (ipAdapter.imageObject) { - const imageDTO = await getImageDTO(ipAdapter.imageObject.name); - if (!imageDTO) { - ipAdapter.imageObject = null; - } - } - if (ipAdapter.model) { - try { - await fetchModelConfigByIdentifier(ipAdapter.model); - } catch { - // MODEL SMITED! - ipAdapter.model = null; - } - } - // No clobber - ipAdapter.id = uuidv4(); - } - clone.id = getRGId(uuidv4()); - dispatch(rgRecalled({ data: clone })); - return; -}; +// for (const ipAdapter of clone.ipAdapters) { +// if (ipAdapter.imageObject) { +// const imageDTO = await getImageDTO(ipAdapter.imageObject.name); +// if (!imageDTO) { +// ipAdapter.imageObject = null; +// } +// } +// if (ipAdapter.model) { +// try { +// await fetchModelConfigByIdentifier(ipAdapter.model); +// } catch { +// // MODEL SMITED! +// ipAdapter.model = null; +// } +// } +// // No clobber +// ipAdapter.id = uuidv4(); +// } +// clone.id = getRGId(uuidv4()); +// dispatch(rgRecalled({ data: clone })); +// return; +// }; //#region Control Layers const recallLayer: MetadataRecallFunc = async (layer) => { diff --git a/invokeai/frontend/web/src/features/metadata/util/validators.ts b/invokeai/frontend/web/src/features/metadata/util/validators.ts index 9d667141a0..41510a8fcf 100644 --- a/invokeai/frontend/web/src/features/metadata/util/validators.ts +++ b/invokeai/frontend/web/src/features/metadata/util/validators.ts @@ -29,17 +29,23 @@ const validateBaseCompatibility = (base?: BaseModelType, message?: string) => { const validateRefinerModel: MetadataValidateFunc = (refinerModel) => { validateBaseCompatibility('sdxl', 'Refiner incompatible with currently-selected model'); - return new Promise((resolve) => resolve(refinerModel)); + return new Promise((resolve) => { + resolve(refinerModel); + }); }; const validateVAEModel: MetadataValidateFunc = (vaeModel) => { validateBaseCompatibility(vaeModel.base, 'VAE incompatible with currently-selected model'); - return new Promise((resolve) => resolve(vaeModel)); + return new Promise((resolve) => { + resolve(vaeModel); + }); }; const validateLoRA: MetadataValidateFunc = (lora) => { validateBaseCompatibility(lora.model.base, 'LoRA incompatible with currently-selected model'); - return new Promise((resolve) => resolve(lora)); + return new Promise((resolve) => { + resolve(lora); + }); }; const validateLoRAs: MetadataValidateFunc = (loras) => { @@ -52,12 +58,16 @@ const validateLoRAs: MetadataValidateFunc = (loras) => { // This is a no-op - we want to continue validating the rest of the LoRAs, and an empty list is valid. } }); - return new Promise((resolve) => resolve(validatedLoRAs)); + return new Promise((resolve) => { + resolve(validatedLoRAs); + }); }; const validateControlNet: MetadataValidateFunc = (controlNet) => { validateBaseCompatibility(controlNet.model?.base, 'ControlNet incompatible with currently-selected model'); - return new Promise((resolve) => resolve(controlNet)); + return new Promise((resolve) => { + resolve(controlNet); + }); }; const validateControlNets: MetadataValidateFunc = (controlNets) => { @@ -70,12 +80,16 @@ const validateControlNets: MetadataValidateFunc = (c // This is a no-op - we want to continue validating the rest of the ControlNets, and an empty list is valid. } }); - return new Promise((resolve) => resolve(validatedControlNets)); + return new Promise((resolve) => { + resolve(validatedControlNets); + }); }; const validateT2IAdapter: MetadataValidateFunc = (t2iAdapter) => { validateBaseCompatibility(t2iAdapter.model?.base, 'T2I Adapter incompatible with currently-selected model'); - return new Promise((resolve) => resolve(t2iAdapter)); + return new Promise((resolve) => { + resolve(t2iAdapter); + }); }; const validateT2IAdapters: MetadataValidateFunc = (t2iAdapters) => { @@ -88,12 +102,16 @@ const validateT2IAdapters: MetadataValidateFunc = (t // This is a no-op - we want to continue validating the rest of the T2I Adapters, and an empty list is valid. } }); - return new Promise((resolve) => resolve(validatedT2IAdapters)); + return new Promise((resolve) => { + resolve(validatedT2IAdapters); + }); }; const validateIPAdapter: MetadataValidateFunc = (ipAdapter) => { validateBaseCompatibility(ipAdapter.model?.base, 'IP Adapter incompatible with currently-selected model'); - return new Promise((resolve) => resolve(ipAdapter)); + return new Promise((resolve) => { + resolve(ipAdapter); + }); }; const validateIPAdapters: MetadataValidateFunc = (ipAdapters) => { @@ -106,10 +124,12 @@ const validateIPAdapters: MetadataValidateFunc = (ipA // This is a no-op - we want to continue validating the rest of the IP Adapters, and an empty list is valid. } }); - return new Promise((resolve) => resolve(validatedIPAdapters)); + return new Promise((resolve) => { + resolve(validatedIPAdapters); + }); }; -const validateLayer: MetadataValidateFunc = async (layer) => { +const validateLayer: MetadataValidateFunc = (layer) => { if (layer.type === 'control_adapter_layer') { const model = layer.controlAdapter.model; assert(model, 'Control Adapter layer missing model'); @@ -141,7 +161,9 @@ const validateLayers: MetadataValidateFunc = async (la // This is a no-op - we want to continue validating the rest of the layers, and an empty list is valid. } } - return new Promise((resolve) => resolve(validatedLayers)); + return new Promise((resolve) => { + resolve(validatedLayers); + }); }; export const validators = { diff --git a/invokeai/frontend/web/src/features/modelManagerV2/subpanels/AddModelPanel/HuggingFaceFolder/HuggingFaceForm.tsx b/invokeai/frontend/web/src/features/modelManagerV2/subpanels/AddModelPanel/HuggingFaceFolder/HuggingFaceForm.tsx index 7257c30007..905063f900 100644 --- a/invokeai/frontend/web/src/features/modelManagerV2/subpanels/AddModelPanel/HuggingFaceFolder/HuggingFaceForm.tsx +++ b/invokeai/frontend/web/src/features/modelManagerV2/subpanels/AddModelPanel/HuggingFaceFolder/HuggingFaceForm.tsx @@ -16,7 +16,7 @@ export const HuggingFaceForm = memo(() => { const [_getHuggingFaceModels, { isLoading, data }] = useLazyGetHuggingFaceModelsQuery(); const [installModel] = useInstallModel(); - const getModels = useCallback(async () => { + const getModels = useCallback(() => { _getHuggingFaceModels(huggingFaceRepo) .unwrap() .then((response) => { diff --git a/invokeai/frontend/web/src/features/modelManagerV2/subpanels/AddModelPanel/ScanFolder/ScanFolderForm.tsx b/invokeai/frontend/web/src/features/modelManagerV2/subpanels/AddModelPanel/ScanFolder/ScanFolderForm.tsx index 1cd036bf13..a78405eb32 100644 --- a/invokeai/frontend/web/src/features/modelManagerV2/subpanels/AddModelPanel/ScanFolder/ScanFolderForm.tsx +++ b/invokeai/frontend/web/src/features/modelManagerV2/subpanels/AddModelPanel/ScanFolder/ScanFolderForm.tsx @@ -16,7 +16,7 @@ export const ScanModelsForm = memo(() => { const [_scanFolder, { isLoading, data }] = useLazyScanFolderQuery(); - const scanFolder = useCallback(async () => { + const scanFolder = useCallback(() => { _scanFolder({ scan_path: scanPath }) .unwrap() .catch((error) => { diff --git a/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/EditableFieldTitle.tsx b/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/EditableFieldTitle.tsx index 617b6141c8..49fd320558 100644 --- a/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/EditableFieldTitle.tsx +++ b/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/EditableFieldTitle.tsx @@ -38,7 +38,7 @@ const EditableFieldTitle = forwardRef((props: Props, ref) => { const [localTitle, setLocalTitle] = useState(label || fieldTemplateTitle || t('nodes.unknownField')); const handleSubmit = useCallback( - async (newTitleRaw: string) => { + (newTitleRaw: string) => { const newTitle = newTitleRaw.trim(); const finalTitle = newTitle || fieldTemplateTitle || t('nodes.unknownField'); setLocalTitle(finalTitle); diff --git a/invokeai/frontend/web/src/features/nodes/components/flow/nodes/common/NodeTitle.tsx b/invokeai/frontend/web/src/features/nodes/components/flow/nodes/common/NodeTitle.tsx index 0252249c0c..58e9bd9915 100644 --- a/invokeai/frontend/web/src/features/nodes/components/flow/nodes/common/NodeTitle.tsx +++ b/invokeai/frontend/web/src/features/nodes/components/flow/nodes/common/NodeTitle.tsx @@ -22,7 +22,7 @@ const NodeTitle = ({ nodeId, title }: Props) => { const [localTitle, setLocalTitle] = useState(''); const handleSubmit = useCallback( - async (newTitle: string) => { + (newTitle: string) => { dispatch(nodeLabelChanged({ nodeId, label: newTitle })); setLocalTitle(label || title || templateTitle || t('nodes.problemSettingTitle')); }, diff --git a/invokeai/frontend/web/src/features/nodes/components/flow/panels/TopPanel/SaveWorkflowButton.tsx b/invokeai/frontend/web/src/features/nodes/components/flow/panels/TopPanel/SaveWorkflowButton.tsx index 937c518aa4..3f47d07f8d 100644 --- a/invokeai/frontend/web/src/features/nodes/components/flow/panels/TopPanel/SaveWorkflowButton.tsx +++ b/invokeai/frontend/web/src/features/nodes/components/flow/panels/TopPanel/SaveWorkflowButton.tsx @@ -13,7 +13,7 @@ const SaveWorkflowButton = () => { const { onOpen } = useSaveWorkflowAsDialog(); const { saveWorkflow } = useSaveLibraryWorkflow(); - const handleClickSave = useCallback(async () => { + const handleClickSave = useCallback(() => { const builtWorkflow = $builtWorkflow.get(); if (!builtWorkflow) { return; diff --git a/invokeai/frontend/web/src/features/nodes/components/sidePanel/inspector/details/EditableNodeTitle.tsx b/invokeai/frontend/web/src/features/nodes/components/sidePanel/inspector/details/EditableNodeTitle.tsx index 5120c5f66f..4a97faa7af 100644 --- a/invokeai/frontend/web/src/features/nodes/components/sidePanel/inspector/details/EditableNodeTitle.tsx +++ b/invokeai/frontend/web/src/features/nodes/components/sidePanel/inspector/details/EditableNodeTitle.tsx @@ -19,7 +19,7 @@ const EditableNodeTitle = ({ nodeId, title }: Props) => { const [localTitle, setLocalTitle] = useState(''); const handleSubmit = useCallback( - async (newTitle: string) => { + (newTitle: string) => { dispatch(nodeLabelChanged({ nodeId, label: newTitle })); setLocalTitle(label || title || templateTitle || t('nodes.problemSettingTitle')); }, diff --git a/invokeai/frontend/web/src/features/nodes/util/schema/parseFieldType.test.ts b/invokeai/frontend/web/src/features/nodes/util/schema/parseFieldType.test.ts index 3d3aff3cd6..152ea05c1c 100644 --- a/invokeai/frontend/web/src/features/nodes/util/schema/parseFieldType.test.ts +++ b/invokeai/frontend/web/src/features/nodes/util/schema/parseFieldType.test.ts @@ -267,7 +267,7 @@ const specialCases: ParseFieldTypeTestCase[] = [ }, ]; -describe('refObjectToSchemaName', async () => { +describe('refObjectToSchemaName', () => { it('parses ref object 1', () => { expect( refObjectToSchemaName({ @@ -284,7 +284,7 @@ describe('refObjectToSchemaName', async () => { }); }); -describe.concurrent('parseFieldType', async () => { +describe.concurrent('parseFieldType', () => { it.each(primitiveTypes)('parses primitive types ($name)', ({ schema, expected }: ParseFieldTypeTestCase) => { expect(parseFieldType(schema)).toEqual(expected); }); diff --git a/invokeai/frontend/web/src/features/nodes/util/workflow/validateWorkflow.test.ts b/invokeai/frontend/web/src/features/nodes/util/workflow/validateWorkflow.test.ts index 6c74acd894..6438d96773 100644 --- a/invokeai/frontend/web/src/features/nodes/util/workflow/validateWorkflow.test.ts +++ b/invokeai/frontend/web/src/features/nodes/util/workflow/validateWorkflow.test.ts @@ -78,8 +78,14 @@ describe('validateWorkflow', () => { ], edges: [], }; - const resolveTrue = async (): Promise => new Promise((resolve) => resolve(true)); - const resolveFalse = async (): Promise => new Promise((resolve) => resolve(false)); + const resolveTrue = (): Promise => + new Promise((resolve) => { + resolve(true); + }); + const resolveFalse = (): Promise => + new Promise((resolve) => { + resolve(false); + }); it('should reset images that are inaccessible', async () => { const validationResult = await validateWorkflow( workflow, diff --git a/invokeai/frontend/web/src/features/stylePresets/components/StylePresetListItem.tsx b/invokeai/frontend/web/src/features/stylePresets/components/StylePresetListItem.tsx index 1bad3bdca3..cf98db1ee6 100644 --- a/invokeai/frontend/web/src/features/stylePresets/components/StylePresetListItem.tsx +++ b/invokeai/frontend/web/src/features/stylePresets/components/StylePresetListItem.tsx @@ -41,7 +41,7 @@ export const StylePresetListItem = ({ preset }: { preset: StylePresetRecordWithI [preset] ); - const handleClickApply = useCallback(async () => { + const handleClickApply = useCallback(() => { dispatch(activeStylePresetIdChanged(preset.id)); $isMenuOpen.set(false); }, [dispatch, preset.id]); diff --git a/invokeai/frontend/web/src/features/system/components/SettingsModal/useClearIntermediates.ts b/invokeai/frontend/web/src/features/system/components/SettingsModal/useClearIntermediates.ts index 4df8d20e29..26ad8a78ad 100644 --- a/invokeai/frontend/web/src/features/system/components/SettingsModal/useClearIntermediates.ts +++ b/invokeai/frontend/web/src/features/system/components/SettingsModal/useClearIntermediates.ts @@ -1,4 +1,3 @@ -import { useAppDispatch } from 'app/store/storeHooks'; import { toast } from 'features/toast/toast'; import { useCallback, useMemo } from 'react'; import { useTranslation } from 'react-i18next'; @@ -15,7 +14,6 @@ type UseClearIntermediatesReturn = { export const useClearIntermediates = (shouldShowClearIntermediates: boolean): UseClearIntermediatesReturn => { const { t } = useTranslation(); - const dispatch = useAppDispatch(); const { data: intermediatesCount, refetch: refetchIntermediatesCount } = useGetIntermediatesCountQuery(undefined, { refetchOnMountOrArgChange: true, @@ -54,7 +52,7 @@ export const useClearIntermediates = (shouldShowClearIntermediates: boolean): Us status: 'error', }); }); - }, [t, _clearIntermediates, dispatch, hasPendingItems]); + }, [t, _clearIntermediates, hasPendingItems]); return { intermediatesCount, clearIntermediates, isLoading, hasPendingItems, refetchIntermediatesCount }; }; diff --git a/invokeai/frontend/web/src/features/ui/components/TabButton.tsx b/invokeai/frontend/web/src/features/ui/components/TabButton.tsx index eedb140cd5..8d7071483c 100644 --- a/invokeai/frontend/web/src/features/ui/components/TabButton.tsx +++ b/invokeai/frontend/web/src/features/ui/components/TabButton.tsx @@ -1,8 +1,8 @@ import { IconButton, Tooltip } from '@invoke-ai/ui-library'; import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; -import type { TabName } from "../store/uiTypes"; import { selectActiveTab } from 'features/ui/store/uiSelectors'; import { setActiveTab } from 'features/ui/store/uiSlice'; +import type { TabName } from "features/ui/store/uiTypes"; import { memo, type ReactElement, useCallback } from 'react'; export const TabButton = memo(({ tab, icon, label }: { tab: TabName; icon: ReactElement; label: string }) => { diff --git a/invokeai/frontend/web/src/features/ui/components/TabMountGate.tsx b/invokeai/frontend/web/src/features/ui/components/TabMountGate.tsx index f131828427..85d8324ea7 100644 --- a/invokeai/frontend/web/src/features/ui/components/TabMountGate.tsx +++ b/invokeai/frontend/web/src/features/ui/components/TabMountGate.tsx @@ -1,7 +1,7 @@ import { createSelector } from '@reduxjs/toolkit'; import { useAppSelector } from 'app/store/storeHooks'; import { selectConfigSlice } from 'features/system/store/configSlice'; -import type { TabName } from "../store/uiTypes"; +import type { TabName } from "features/ui/store/uiTypes"; import type { PropsWithChildren } from 'react'; import { memo, useMemo } from 'react'; diff --git a/invokeai/frontend/web/src/features/ui/components/TabVisibilityGate.tsx b/invokeai/frontend/web/src/features/ui/components/TabVisibilityGate.tsx index 8f64049b21..1984480430 100644 --- a/invokeai/frontend/web/src/features/ui/components/TabVisibilityGate.tsx +++ b/invokeai/frontend/web/src/features/ui/components/TabVisibilityGate.tsx @@ -1,6 +1,6 @@ import { Box } from '@invoke-ai/ui-library'; import { useAppSelector } from 'app/store/storeHooks'; -import type { TabName } from "../store/uiTypes"; +import type { TabName } from "features/ui/store/uiTypes"; import type { PropsWithChildren } from 'react'; import { memo } from 'react'; diff --git a/invokeai/frontend/web/src/features/ui/store/uiSlice.ts b/invokeai/frontend/web/src/features/ui/store/uiSlice.ts index 855f7ab2f1..32c3485657 100644 --- a/invokeai/frontend/web/src/features/ui/store/uiSlice.ts +++ b/invokeai/frontend/web/src/features/ui/store/uiSlice.ts @@ -4,8 +4,7 @@ import type { PersistConfig, RootState } from 'app/store/store'; import { workflowLoadRequested } from 'features/nodes/store/actions'; import { atom } from 'nanostores'; -import type { TabName } from "./uiTypes"; -import type { UIState } from './uiTypes'; +import type { TabName , UIState } from "./uiTypes"; const initialUIState: UIState = { _version: 2, diff --git a/invokeai/frontend/web/src/features/workflowLibrary/components/WorkflowLibraryMenu/SaveWorkflowMenuItem.tsx b/invokeai/frontend/web/src/features/workflowLibrary/components/WorkflowLibraryMenu/SaveWorkflowMenuItem.tsx index 6ff744bc3b..0a973cc92c 100644 --- a/invokeai/frontend/web/src/features/workflowLibrary/components/WorkflowLibraryMenu/SaveWorkflowMenuItem.tsx +++ b/invokeai/frontend/web/src/features/workflowLibrary/components/WorkflowLibraryMenu/SaveWorkflowMenuItem.tsx @@ -13,7 +13,7 @@ const SaveWorkflowMenuItem = () => { const { onOpen } = useSaveWorkflowAsDialog(); const isTouched = useAppSelector((s) => s.workflow.isTouched); - const handleClickSave = useCallback(async () => { + const handleClickSave = useCallback(() => { const builtWorkflow = $builtWorkflow.get(); if (!builtWorkflow) { return; diff --git a/invokeai/frontend/web/src/features/workflowLibrary/hooks/useLoadWorkflowFromFile.tsx b/invokeai/frontend/web/src/features/workflowLibrary/hooks/useLoadWorkflowFromFile.tsx index 94a1ef5c51..a32a816fce 100644 --- a/invokeai/frontend/web/src/features/workflowLibrary/hooks/useLoadWorkflowFromFile.tsx +++ b/invokeai/frontend/web/src/features/workflowLibrary/hooks/useLoadWorkflowFromFile.tsx @@ -16,7 +16,7 @@ type UseLoadWorkflowFromFile = (options: useLoadWorkflowFromFileOptions) => (fil export const useLoadWorkflowFromFile: UseLoadWorkflowFromFile = ({ resetRef, onSuccess }) => { const dispatch = useAppDispatch(); - const logger = useLogger('nodes'); + const logger = useLogger('workflows'); const { t } = useTranslation(); const loadWorkflowFromFile = useCallback( (file: File | null) => { @@ -24,7 +24,7 @@ export const useLoadWorkflowFromFile: UseLoadWorkflowFromFile = ({ resetRef, onS return; } const reader = new FileReader(); - reader.onload = async () => { + reader.onload = () => { const rawJSON = reader.result; try { diff --git a/invokeai/frontend/web/src/services/api/endpoints/images.ts b/invokeai/frontend/web/src/services/api/endpoints/images.ts index 0e50b5b8e9..5dfc400fa0 100644 --- a/invokeai/frontend/web/src/services/api/endpoints/images.ts +++ b/invokeai/frontend/web/src/services/api/endpoints/images.ts @@ -52,7 +52,7 @@ export const imagesApi = api.injectEndpoints({ 'FetchOnReconnect', ]; }, - async onQueryStarted(_, { dispatch, queryFulfilled }) { + onQueryStarted(_, { dispatch, queryFulfilled }) { // Populate the getImageDTO cache with these images. This makes image selection smoother, because it doesn't // need to re-fetch image data when the user selects an image. The getImageDTO cache keeps data for the default // of 60s, so this data won't stick around too long. diff --git a/invokeai/frontend/web/src/services/api/endpoints/models.ts b/invokeai/frontend/web/src/services/api/endpoints/models.ts index 881a24a68d..e83985f8ef 100644 --- a/invokeai/frontend/web/src/services/api/endpoints/models.ts +++ b/invokeai/frontend/web/src/services/api/endpoints/models.ts @@ -245,7 +245,7 @@ export const modelsApi = api.injectEndpoints({ transformResponse: (response: GetModelConfigsResponse) => { return modelConfigsAdapter.setAll(modelConfigsAdapter.getInitialState(), response.models); }, - onQueryStarted: async (_, { dispatch, queryFulfilled }) => { + onQueryStarted: (_, { dispatch, queryFulfilled }) => { queryFulfilled.then(({ data }) => { modelConfigsAdapterSelectors.selectAll(data).forEach((modelConfig) => { dispatch(modelsApi.util.upsertQueryData('getModelConfig', modelConfig.key, modelConfig)); diff --git a/invokeai/frontend/web/src/services/api/index.ts b/invokeai/frontend/web/src/services/api/index.ts index 828388b079..bbebbdb156 100644 --- a/invokeai/frontend/web/src/services/api/index.ts +++ b/invokeai/frontend/web/src/services/api/index.ts @@ -49,11 +49,7 @@ const tagTypes = [ export type ApiTagDescription = TagDescription<(typeof tagTypes)[number]>; export const LIST_TAG = 'LIST'; -const dynamicBaseQuery: BaseQueryFn = async ( - args, - api, - extraOptions -) => { +const dynamicBaseQuery: BaseQueryFn = (args, api, extraOptions) => { const baseUrl = $baseUrl.get(); const authToken = $authToken.get(); const projectId = $projectId.get();