mirror of
https://github.com/Komediruzecki/token-circles.git
synced 2026-10-20 09:46:43 +02:00
* feat(pwa): update toast with a Reload button, sleeker top-right notifications, Android install hint The 'new version' notice was a 4s bottom toast with no button; it now announces once, top-right, with a Reload action that goes through reloadToLatest, and it stands down on rollback. The safe-moment auto-reload waits out focused inputs and open modals (userIsMidEntry). The crash modal's Reload also goes through reloadToLatest — a plain location.reload() was re-served the dead build from the SW precache — and stale-chunk errors no longer flash the crash modal while bootRecovery's quiet reload is in flight. The toast store gains title, action, channel and per-type durations, drawn mercurypitch-style from theme tokens. Android browsers that never fire beforeinstallprompt get a menu hint that swaps to the real install button the moment the event arrives. * fix(review): make the mid-entry guard see only OPEN dialogs, keep chunk errors classifiable, harden the toast store Review findings on the previous commit, each verified live or by test: - userIsMidEntry matched any role=dialog node, and CommandBar/GuidedOrbit keep theirs mounted permanently behind pointer-events:none — the check was true on every page and silently killed the safe-moment auto-reload. It now counts only dialogs whose computed pointer-events is not none (plus alertdialog for the destructive confirms), and ignores focus resting on checkboxes and other non-entry input types, which otherwise vetoes the reload forever. - bootRecovery only preventDefaults vite:preloadError when it will actually reload; a prevented event makes Vite resolve the import as undefined, whose TypeError nothing can classify as a stale chunk. Standing down now lets the original error rethrow so the crash modal shows its update flavour. - The in-flight recovery flag is a signal with a 10s deadline, and the SolidErrorBoundary render fallback (the path a dead lazy route actually takes) renders nothing while it is set — the modal appears if the reload never lands instead of being suppressed forever or flashing over a recovering page. - The update toast re-announces on later polls once the previous notice expired, now with the server's version; a notice still on screen is left alone. - The toast store caps the stack at 4 (the mobile overflow scroller could never scroll under the container's pointer-events:none), picks its fields explicitly instead of spreading durationMs onto items, and treats non-finite durations as the default. - The Android install hint stays away once beforeinstallprompt has fired (the sheet consumes the event before resolving, which swapped the button for the hint mid-sheet) and inside Android WebViews, which have no install menu. The install branches are one flat Switch instead of nested Show fallbacks. - Reverted the role=dialog addition to Modal.tsx — the component is dead code and the comment claimed a protection nothing exercises. - Tests: fake timers restored in afterEach, DOM cleanup moved to afterEach, new coverage for every behavior above.