Skip to content

Commit 4090592

Browse files
authored
chore: add delay before forced page-reload (#916)
1 parent 1d1e58f commit 4090592

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

ui/src/routes/devices.$id.settings.advanced.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,8 @@ export default function SettingsAdvancedRoute() {
313313
text={m.advanced_reset_config_button()}
314314
onClick={() => {
315315
handleResetConfig();
316+
// Add 2s delay between resetting the configuration and calling reload() to prevent reload from interrupting the RPC call to reset things.
317+
await sleep(2000);
316318
window.location.reload();
317319
}}
318320
/>

ui/src/routes/devices.$id.settings.general.reboot.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ export default function SettingsGeneralRebootRoute() {
1111

1212
const onClose = useCallback(() => {
1313
navigate(".."); // back to the devices.$id.settings page
14+
// Add 1s delay between navigation and calling reload() to prevent reload from interrupting the navigation.
15+
await sleep(1000);
1416
window.location.reload(); // force a full reload to ensure the current device/cloud UI version is loaded
1517
}, [navigate]);
1618

ui/src/routes/devices.$id.settings.general.update.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ export default function SettingsGeneralUpdateRoute() {
2323

2424
const onClose = useCallback(() => {
2525
navigate(".."); // back to the devices.$id.settings page
26+
// Add 1s delay between navigation and calling reload() to prevent reload from interrupting the navigation.
27+
await sleep(1000);
2628
window.location.reload(); // force a full reload to ensure the current device/cloud UI version is loaded
2729
}, [navigate]);
2830

0 commit comments

Comments
 (0)