From 4017609b912562c789379fb97293e3ae05246b48 Mon Sep 17 00:00:00 2001 From: chainchompa Date: Tue, 23 Jul 2024 16:43:30 -0400 Subject: [PATCH] clean up useIsAllowedToUpscale since its no longer necessary --- .../listeners/upscaleRequested.ts | 17 ---- .../Upscale/ParamUpscaleSettings.tsx | 12 ++- .../parameters/hooks/useIsAllowedToUpscale.ts | 84 ------------------- 3 files changed, 5 insertions(+), 108 deletions(-) delete mode 100644 invokeai/frontend/web/src/features/parameters/hooks/useIsAllowedToUpscale.ts diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/upscaleRequested.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/upscaleRequested.ts index d5fd1ae8ca..d2e40b4664 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/upscaleRequested.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/upscaleRequested.ts @@ -3,7 +3,6 @@ import { logger } from 'app/logging/logger'; import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { parseify } from 'common/util/serialize'; import { buildAdHocUpscaleGraph } from 'features/nodes/util/graph/buildAdHocUpscaleGraph'; -import { createIsAllowedToUpscaleSelector } from 'features/parameters/hooks/useIsAllowedToUpscale'; import { toast } from 'features/toast/toast'; import { t } from 'i18next'; import { queueApi } from 'services/api/endpoints/queue'; @@ -20,22 +19,6 @@ export const addUpscaleRequestedListener = (startAppListening: AppStartListening const { imageDTO } = action.payload; const state = getState(); - const { isAllowedToUpscale, detailTKey } = createIsAllowedToUpscaleSelector(imageDTO)(state); - - // if we can't upscale, show a toast and return - if (!isAllowedToUpscale) { - log.error( - { imageDTO }, - t(detailTKey ?? 'parameters.isAllowedToUpscale.tooLarge') // should never coalesce - ); - toast({ - id: 'NOT_ALLOWED_TO_UPSCALE', - title: t(detailTKey ?? 'parameters.isAllowedToUpscale.tooLarge'), // should never coalesce - status: 'error', - }); - return; - } - const enqueueBatchArg: BatchConfig = { prepend: true, batch: { diff --git a/invokeai/frontend/web/src/features/parameters/components/Upscale/ParamUpscaleSettings.tsx b/invokeai/frontend/web/src/features/parameters/components/Upscale/ParamUpscaleSettings.tsx index 99adbb0e0e..9c5a5c943a 100644 --- a/invokeai/frontend/web/src/features/parameters/components/Upscale/ParamUpscaleSettings.tsx +++ b/invokeai/frontend/web/src/features/parameters/components/Upscale/ParamUpscaleSettings.tsx @@ -9,8 +9,7 @@ import { useDisclosure, } from '@invoke-ai/ui-library'; import { upscaleRequested } from 'app/store/middleware/listenerMiddleware/listeners/upscaleRequested'; -import { useAppDispatch } from 'app/store/storeHooks'; -import { useIsAllowedToUpscale } from 'features/parameters/hooks/useIsAllowedToUpscale'; +import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; import { useIsQueueMutationInProgress } from 'features/queue/hooks/useIsQueueMutationInProgress'; import { UpscaleWarning } from 'features/settingsAccordions/components/UpscaleSettingsAccordion/UpscaleWarning'; import { memo, useCallback } from 'react'; @@ -25,18 +24,18 @@ type Props = { imageDTO?: ImageDTO }; const ParamUpscalePopover = (props: Props) => { const { imageDTO } = props; const dispatch = useAppDispatch(); + const { simpleUpscaleModel } = useAppSelector((s) => s.upscale); const inProgress = useIsQueueMutationInProgress(); const { t } = useTranslation(); const { isOpen, onOpen, onClose } = useDisclosure(); - const { isAllowedToUpscale, detail } = useIsAllowedToUpscale(imageDTO); const handleClickUpscale = useCallback(() => { onClose(); - if (!imageDTO || !isAllowedToUpscale) { + if (!imageDTO) { return; } dispatch(upscaleRequested({ imageDTO })); - }, [dispatch, imageDTO, isAllowedToUpscale, onClose]); + }, [dispatch, imageDTO, onClose]); return ( @@ -54,9 +53,8 @@ const ParamUpscalePopover = (props: Props) => {