PluginProbe
Extendify / 3.1.5
Extendify v3.1.5
3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 All 127 releases
extendify / src / Agent / lib / reload.js

reload.js in Extendify 3.1.5, at src/Agent/lib/reload.js

21 lines 711 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { flushChatStorage } from '@agent/state/chat';
2 import { useStatusStore } from '@agent/state/status';
3
4 const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
5
6 // Components navigate through this so the pending chat save always lands first.
7 export const doReload = async (url) => {
8 const flush = flushChatStorage();
9 // Quick saves skip the overlay; once shown it holds 1s so it never flashes.
10 const saveIsSlow = await Promise.race([
11 flush.then(() => false),
12 wait(2000).then(() => true),
13 ]);
14 if (saveIsSlow) {
15 useStatusStore.getState().setLeavingPage(true);
16 await Promise.all([flush, wait(1000)]);
17 }
18 if (url) return window.location.assign(url);
19 window.location.reload();
20 };
21