useBackToClose eagerly pushed a history entry on mount and called history.back() on unmount. During a modal->modal handoff (e.g. About -> Release Notes) the two ran interleaved in one React commit, so the entering modal's popstate listener mistook the leaving modal's back() for a genuine user Back and closed itself instantly. It also left the history pointer behind the surviving entry, so a later browser Back walked off the app. Replace the eager per-mount push/pop with a single shared popstate handler plus a coalesced microtask that reconciles history depth to the live overlay count once per tick. A handoff's -1/+1 nets to zero, so the new modal simply reuses the old entry -- no churn, no flash, and Back closes the modal in-app. |
||
|---|---|---|
| .. | ||
| public/welcome | ||
| src | ||
| index.html | ||
| package-lock.json | ||
| package.json | ||
| postcss.config.js | ||
| tailwind.config.js | ||
| tsconfig.json | ||
| vite.config.ts | ||