From 409059211230fd99b9ca1afe2455387c9fd00fba Mon Sep 17 00:00:00 2001 From: Marc Brooks Date: Tue, 4 Nov 2025 08:12:03 -0600 Subject: [PATCH] chore: add delay before forced page-reload (#916) --- ui/src/routes/devices.$id.settings.advanced.tsx | 2 ++ ui/src/routes/devices.$id.settings.general.reboot.tsx | 2 ++ ui/src/routes/devices.$id.settings.general.update.tsx | 2 ++ 3 files changed, 6 insertions(+) diff --git a/ui/src/routes/devices.$id.settings.advanced.tsx b/ui/src/routes/devices.$id.settings.advanced.tsx index ea2ca76c..dbc98a75 100644 --- a/ui/src/routes/devices.$id.settings.advanced.tsx +++ b/ui/src/routes/devices.$id.settings.advanced.tsx @@ -313,6 +313,8 @@ export default function SettingsAdvancedRoute() { text={m.advanced_reset_config_button()} onClick={() => { handleResetConfig(); + // Add 2s delay between resetting the configuration and calling reload() to prevent reload from interrupting the RPC call to reset things. + await sleep(2000); window.location.reload(); }} /> diff --git a/ui/src/routes/devices.$id.settings.general.reboot.tsx b/ui/src/routes/devices.$id.settings.general.reboot.tsx index fa692c7a..5a4474e6 100644 --- a/ui/src/routes/devices.$id.settings.general.reboot.tsx +++ b/ui/src/routes/devices.$id.settings.general.reboot.tsx @@ -11,6 +11,8 @@ export default function SettingsGeneralRebootRoute() { const onClose = useCallback(() => { navigate(".."); // back to the devices.$id.settings page + // Add 1s delay between navigation and calling reload() to prevent reload from interrupting the navigation. + await sleep(1000); window.location.reload(); // force a full reload to ensure the current device/cloud UI version is loaded }, [navigate]); diff --git a/ui/src/routes/devices.$id.settings.general.update.tsx b/ui/src/routes/devices.$id.settings.general.update.tsx index 48c2168b..3a52eee2 100644 --- a/ui/src/routes/devices.$id.settings.general.update.tsx +++ b/ui/src/routes/devices.$id.settings.general.update.tsx @@ -23,6 +23,8 @@ export default function SettingsGeneralUpdateRoute() { const onClose = useCallback(() => { navigate(".."); // back to the devices.$id.settings page + // Add 1s delay between navigation and calling reload() to prevent reload from interrupting the navigation. + await sleep(1000); window.location.reload(); // force a full reload to ensure the current device/cloud UI version is loaded }, [navigate]);