Skip to content

Commit

Permalink
fix: double popups at the same time
Browse files Browse the repository at this point in the history
  • Loading branch information
Palm authored Mar 18, 2024
1 parent 38bc47c commit 714078e
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions src/ui/settings/pages/General.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@ export default function General() {
}
value={settings.developmentBuildEnabled}
onValueChange={(v: boolean) => {
const callback = () =>
setDevelopmentBuildEnabled(v).then(showReloadRequiredAlert);

if (v)
showConfirmationAlert({
title: "Use development builds?",
Expand All @@ -192,19 +195,9 @@ export default function General() {
confirmText: "Continue",
cancelText: "Nevermind",
confirmColor: ButtonColors.RED,
onConfirm: () => setDevelopmentBuildEnabled(v)
onConfirm: callback
});
else setDevelopmentBuildEnabled(v);

showConfirmationAlert({
title: "Reload required",
content:
"Changes will only apply next time the app launches or reloads.",
confirmText: "Reload now",
cancelText: "Later",
confirmColor: ButtonColors.PRIMARY,
onConfirm: BundleUpdaterManager.reload
});
else callback()
}}
/>
<FormDivider />
Expand Down Expand Up @@ -254,3 +247,14 @@ export default function General() {
</ErrorBoundary>
);
}

const showReloadRequiredAlert = () =>
showConfirmationAlert({
title: "Reload required",
content:
"Changes will only apply next time the app launches or reloads.",
confirmText: "Reload now",
cancelText: "Later",
confirmColor: ButtonColors.PRIMARY,
onConfirm: BundleUpdaterManager.reload
});

0 comments on commit 714078e

Please sign in to comment.