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 <maryhipp@Marys-MacBook-Air.local>
This commit is contained in:
Mary Hipp Rogers 2024-01-05 09:40:34 -05:00 committed by GitHub
parent cb7e56a9a3
commit 12e9f17f7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 7 deletions

View File

@ -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,

View File

@ -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,
}
);