Uh oh!
There was an error while loading. Please reload this page.
fix(web): open new session in one tab, not two - #72
Merged
Conversation
With noopener set, window.open returns null on every call. That is specified behaviour, not a popup block, so the popup-blocked fallback navigated this tab unconditionally and every click spawned two sessions. Drop the fallback: the tab is the only path, and a genuinely blocked popup is recoverable through the browser's own UI. Closes#69 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Uh oh!
There was an error while loading. Please reload this page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Creating a session from the UI produced two sessions: one in the current tab and one in a newly opened tab. This drops the popup-blocked fallback in
useOpenNewSessionso the new tab is the only path.Why
window.open(href, '_blank', 'noopener')returnsnullon every call. That is specified behaviour, not a popup block:noopenersevers the handle the caller would otherwise get back. So the fallbackif (tab === null) void router.navigate({ to: href })fired unconditionally, the popup opened and this tab navigated, and/newspawned a session in each.This is option 1 from the issue, listed there as preferred: a genuinely blocked popup is rare, and the browser's own blocked-popup UI is the recovery. The hook's doc comment now records why there is deliberately no fallback, so it does not get reintroduced.
Test
New
web/src/sessions/open-new-session.test.tsxpins both halves:/new?...in a tab with_blankandnoopener, oncewindow.openreturnednullThe second test fails against the old code (the fallback navigates the test router to
/new) and passes deterministically against the new. Also rewords a comment inweb/src/routes/new-session.test.tsxthat described the removed fallback as the way an already-connected tab arrives.pnpm vitest run: 68 files, 1359 tests, all passing.pnpm run lintclean.Closes#69
🤖 Generated with Claude Code