Skip to content

[0.42-r2 H3] popstate guard __enhancedNav is memory-only — reload breaks the §10 promise #578

Description

@SisyphusZheng

Severity: high · Category: implementation bug

Evidence. entry-generators.ts: var __enhancedNav = false; set on enhanced pushState; the popstate handler reloads only when it is true. After an enhanced navigation the user reloads the page (variable resets), then presses Back: popstate fires, the guard is false, nothing happens — URL shows the pre-submit entry while the document shows the post-submit page, contradicting ADR-0121 §10 ('back/forward never shows content that disagrees with the URL').

Fix. Persist the marker in sessionStorage (guarded for privacy modes) instead of a module variable.

Acceptance. e2e: enhanced submit → reload → Back reloads the restored URL.


Filed from the 0.42 round-2 review (docs/audit/2026-07-28-alpha5-round2-review.md). Target line: 0.42.0-alpha.6.

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.42.0-alpha.60.42 round-2 review remediation (morph client hardening)bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions