Skip to content

Let browser Back leave the form Settings page - #287

Merged
PhilReinking merged 4 commits into
mainfrom
fix/bits-291-settings-back
Oct 17, 2026
Merged

PhilReinking merged 4 commits into
mainfrom
fix/bits-291-settings-back

Conversation

@PhilReinking

Copy link
Copy Markdown
Contributor

Switching a Settings tab now replaces the current history entry instead of adding one, so browser Back from Settings shows the editor. A link like #completion-page still opens its tab.

Tested: new Vitest tests fail without the fix; lint and vue-tsc pass; in a real browser one Back from Settings after four tab clicks shows the editor.

Not tested: Forward after Back, browsers other than Chromium.

Fixes BITS-291

🤖 Generated with Claude Code

PhilReinking and others added 2 commits October 16, 2026 20:20
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@PhilReinking
PhilReinking marked this pull request as ready for review October 16, 2026 18:21

@PhilReinking PhilReinking left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes at 7f10c4f: one must, inline. Checked beyond the PR text in headless Brave: from the editor, Back then Forward, a reload on a #tab, and a Back that reloads the page all keep the right page and tab. A fresh load of /settings without #tab still needs two Backs (inline). Not blocking: leaving Settings by the Editor link, then Back, now opens the first tab, not the one you left; main kept it.

// replace the entry: a new one per tab would trap browser Back on Settings.
// Inertia reads history.state.url on a Back that reloads, so it follows the hash
const url = `${location.pathname}${location.search}#${item.slug}`;
history.replaceState({ ...history.state, url }, "", url);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On a full load of /settings without #tab, setup calls this (lines 122–126) before Inertia saves its first page, so Inertia pushes a 2nd entry. The first Back then lands on an entry without a page: "Page not found: ./Pages/undefined.vue", still on Settings. In setup, only set selectedTabIndex.

… Back

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@PhilReinking PhilReinking left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK at 61d9717. Hanke's must is fixed: a fresh load of /settings without #tab adds one history entry, and one Back opens the editor, no page error. Held in Brave: 4 tabs then Back and Forward, the #completion-page link, reload on a tab, a Back that reloads. Editor link then Back now keeps the tab. Setting router.page.url is safe: Inertia only writes it back to history, as it does for a #link. Both new tests fail on the old code.

@PhilReinking PhilReinking left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK at e4759a8, CI green. Re-check of the changelog merge only: merging main conflicted only in CHANGELOG.md and changes no other file. The code diff vs main is the same as at 61d9717. The #287 line is word for word as before, 1 line added and 0 removed, first in Fixed. It merges cleanly with #289 and #290, in pairs and all 3 together. The OK at 61d9717 covers the rest.

@PhilReinking
PhilReinking merged commit 9b191ec into main Oct 17, 2026
6 checks passed
@PhilReinking
PhilReinking deleted the fix/bits-291-settings-back branch October 17, 2026 00:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant