Skip to content

A reload on a file preview opened over Settings reopens Settings #828

Closed

Description

@devswha

Problem

A link that names both a file and Settings (?pane=…&file=…&settings=about) can leave Settings open after a reload, where a reload is meant to close it.

  1. The link opens Settings, which pushes its history entry (depth 1 on a desktop).
  2. The pending file then opens: openFile (src/lib/useFileViewer.ts) pushes the preview's entry by spreading the current state, so that entry carries a copy of the Settings marker.
  3. Reload on the preview's entry: lib/settingsHistory.ts steps back by the marker's depth (go(-1)) and lands on the Settings entry under it, not under Settings.
  4. That landing is not the module's own (it does not match the destination it asked for), so App opens Settings from it. The preview can also go: the popstate handler clears it after the pending file was dropped.

Found in review of #825 (by a code read, not yet reproduced in a browser). #825 fixed a different cause of the same symptom: the address read at load, before or after the step back lands.

Expected

A reload with Settings open closes Settings, whatever else the history holds above it, and a file the address names stays open.

Notes

Either the preview's entry should not copy the Settings marker, or the step back should count the entries actually above the app rather than trust the marker's depth. A regression case belongs in scripts/settings-pages-demo-regression.ts or scripts/file-viewer-regression.ts: a file-plus-Settings link, then a reload.

Activity

  1. added a commit that references this issue on Oct 14, 2026
    bfaafae
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions