Skip to content

Commit

Permalink
When ignoring an update, don't show update dialog again
Browse files Browse the repository at this point in the history
  • Loading branch information
olegbl committed Jul 28, 2024
1 parent 50c21d2 commit 93c6e7b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/renderer/react/UpdaterDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
useDialogContext,
} from 'renderer/react/context/DialogContext';
import useAsyncCallback from 'renderer/react/hooks/useAsyncCallback';
import useSavedState from 'renderer/react/hooks/useSavedState';
import { useCallback, useEffect, useMemo, useState } from 'react';
import {
Button,
Expand Down Expand Up @@ -135,13 +136,18 @@ function ProgressDialog({
}

export default function UpdaterDialog() {
const [isUpdateIgnored, setIsUpdateIgnored] = useState<boolean>(false);
const [ignoredUpdateVersion, setIgnoredUpdateVersion] = useSavedState<
string | void
>('ignored-update', undefined);
const [update] = useUpdate();
const updaterState = useUpdaterState();

const isUpdateIgnored =
update != null && update.version === ignoredUpdateVersion;

const onIgnore = useCallback(() => {
setIsUpdateIgnored(true);
}, []);
setIgnoredUpdateVersion(update?.version);
}, [setIgnoredUpdateVersion, update?.version]);

const onInstall = useAsyncCallback(async () => {
if (update != null) {
Expand Down

0 comments on commit 93c6e7b

Please sign in to comment.