Skip to content

Commit

Permalink
Disable webUI update check when auto update is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
schroda committed Apr 21, 2024
1 parent d524100 commit ebd84d5
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/components/util/WebUIUpdateChecker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,20 @@ import { makeToast } from '@/components/util/Toast.tsx';
import { ABOUT_WEBUI, WEBUI_UPDATE_CHECK } from '@/lib/graphql/Fragments.ts';
import { useUpdateChecker } from '@/util/useUpdateChecker.tsx';

const disabledUpdateCheck = () => Promise.resolve();

export const WebUIUpdateChecker = () => {
const { t } = useTranslation();

const [webUIVersion, setWebUIVersion] = useLocalStorage<string>('webUIVersion');
const [open, setOpen] = useState(false);

const serverSettings = requestManager.useGetServerSettings();
const isAutoUpdateEnabled = !serverSettings.data?.settings.webUIUpdateCheckInterval;
const isAutoUpdateEnabled = !!serverSettings.data?.settings.webUIUpdateCheckInterval;

const { data: webUIUpdateData, refetch: checkForUpdate } = requestManager.useCheckForWebUIUpdate({
skip: isAutoUpdateEnabled,
notifyOnNetworkStatusChange: true,
fetchPolicy: 'cache-only',
});

const { data: webUIUpdateStatusData } = requestManager.useGetWebUIUpdateStatus();
Expand All @@ -44,7 +46,11 @@ export const WebUIUpdateChecker = () => {
info: undefined,
}) satisfies OptionalProperty<WebUiUpdateStatus, 'info'>;

const updateChecker = useUpdateChecker('webUI', checkForUpdate, webUIUpdateData?.checkForWebUIUpdate.tag);
const updateChecker = useUpdateChecker(
'webUI',
isAutoUpdateEnabled ? disabledUpdateCheck : checkForUpdate,
webUIUpdateData?.checkForWebUIUpdate.tag,
);

const changelogUrl =
updateStatus.info?.channel === WebUiChannel.Stable
Expand Down

0 comments on commit ebd84d5

Please sign in to comment.