From 12e9f17f7a3dfa3e96d014e78631027bd6bd06e2 Mon Sep 17 00:00:00 2001 From: Mary Hipp Rogers Date: Fri, 5 Jan 2024 09:40:34 -0500 Subject: [PATCH] only GET intermediates if that setting is an option (#5416) * only GET intermediates if that setting is an option * lint --------- Co-authored-by: Mary Hipp --- .../system/components/SettingsModal/SettingsModal.tsx | 11 +++++------ .../components/SettingsModal/useClearIntermediates.ts | 5 ++++- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/invokeai/frontend/web/src/features/system/components/SettingsModal/SettingsModal.tsx b/invokeai/frontend/web/src/features/system/components/SettingsModal/SettingsModal.tsx index d1d29c11c7..104061f08a 100644 --- a/invokeai/frontend/web/src/features/system/components/SettingsModal/SettingsModal.tsx +++ b/invokeai/frontend/web/src/features/system/components/SettingsModal/SettingsModal.tsx @@ -37,11 +37,10 @@ import { SettingsLanguageSelect } from './SettingsLanguageSelect'; import { SettingsLogLevelSelect } from './SettingsLogLevelSelect'; type ConfigOptions = { - shouldShowDeveloperSettings: boolean; - shouldShowResetWebUiText: boolean; - shouldShowAdvancedOptionsSettings: boolean; - shouldShowClearIntermediates: boolean; - shouldShowLocalizationToggle: boolean; + shouldShowDeveloperSettings?: boolean; + shouldShowResetWebUiText?: boolean; + shouldShowClearIntermediates?: boolean; + shouldShowLocalizationToggle?: boolean; }; type SettingsModalProps = { @@ -84,7 +83,7 @@ const SettingsModal = ({ children, config }: SettingsModalProps) => { hasPendingItems, intermediatesCount, isLoading: isLoadingClearIntermediates, - } = useClearIntermediates(); + } = useClearIntermediates(shouldShowClearIntermediates); const { isOpen: isSettingsModalOpen, 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 90f5dee8b0..0bd56e0e22 100644 --- a/invokeai/frontend/web/src/features/system/components/SettingsModal/useClearIntermediates.ts +++ b/invokeai/frontend/web/src/features/system/components/SettingsModal/useClearIntermediates.ts @@ -17,7 +17,9 @@ export type UseClearIntermediatesReturn = { hasPendingItems: boolean; }; -export const useClearIntermediates = (): UseClearIntermediatesReturn => { +export const useClearIntermediates = ( + shouldShowClearIntermediates: boolean +): UseClearIntermediatesReturn => { const { t } = useTranslation(); const dispatch = useAppDispatch(); @@ -25,6 +27,7 @@ export const useClearIntermediates = (): UseClearIntermediatesReturn => { undefined, { refetchOnMountOrArgChange: true, + skip: !shouldShowClearIntermediates, } );