Skip to content

Stop the New workspace field reopening after a search - #260

Merged
BunsDev merged 6 commits into
mainfrom
notes-new-workspace-once
Oct 16, 2026
Merged

BunsDev merged 6 commits into
mainfrom
notes-new-workspace-once

Conversation

@BunsDev

@BunsDev BunsDev commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Part of #241 (finding 9: New workspace re-opens after a remount).

Probe

  1. Space › Space options › New workspace, type a name, press Enter.
  2. Click Search pages, type a letter, then clear the search.

The notes tree comes back with an empty, focused "New workspace name" field. Keystrokes go into it, and clicking away makes another workspace.

The cause: SpaceView asked for the field by bumping a newWorkspace counter that was never reset. A search unmounts NotesTreeView, and when it mounts again its effect sees a non-zero counter and opens the field again.

Fix

newWorkspace is now a flag in SpaceView. The tree calls onNewWorkspaceOpened once it has opened the field, and SpaceView clears the flag, so a later remount has nothing to replay. This is how SpaceView already consumes the "Open notes" focus request (focusNode / onFocusApplied), whose comment says search unmounts the tree and must not replay old requests. The field's commit and cancel paths are unchanged. The review suggested clearing the request on commit or cancel instead. Clearing it when the field opens has the same effect, because the tree can only unmount after focus has left the field, and leaving the field already commits or closes it. It also needs one callback instead of two.

Regression test

e2e/notes-tree.spec.ts › "a search does not reopen New workspace after one was made" makes a workspace, types in the page search and clears it, then checks that:

  • the "New workspace name" field is not shown
  • the search box keeps focus and receives typing
  • closing the search with Escape doesn't reopen the field or create a Stray workspace on disk

On unmodified main it fails at the first of these checks (New workspace name count was 1, expected 0). It passes with the fix.

Ran

  • pnpm build && pnpm test from the worktree root: passed, 0 failures (desktop: 1,437 tests, 1,421 pass, 16 skipped; core, worktree scripts, site and store suites all pass)
  • pnpm exec playwright test e2e/notes-tree.spec.ts e2e/space.spec.ts e2e/notes.spec.ts: 16 passed
  • pnpm exec playwright test e2e/sidebar-workspaces.spec.ts (the other New workspace flow, and Open notes remounts): 2 passed
  • No flakes. CI runs the full e2e suite.

docs/status.md gets one line under "On main, unreleased".

Coven-Harness: Claude Code / claude-opus-5-5

Before: Space options > New workspace bumped a counter that was never
reset. A page search unmounts the notes tree, so clearing the search
remounted it, the tree saw the old request again and opened an empty,
focused "New workspace name" field. Typing landed there, and clicking
away made another workspace.

After: the request is a flag that SpaceView clears as soon as the tree
opens the field, the same way it already consumes "Open notes" focus
requests, so a remount has nothing to replay. A new e2e case makes a
workspace, searches, clears the search and checks the field stays
closed and typing stays in the search box.

Part of #241.

Coven-Harness: Claude Code / claude-opus-5-5
@vercel

vercel Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
modex Ready Ready Preview Oct 16, 2026 10:15am UTC

Request Review

@github-code-quality

github-code-quality Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Code coverage overview

Languages: TypeScript

TypeScript / code-coverage-agent

main 9668924 notes-new-workspace-... a1a9fd5 +/-
61% 61% 0%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.


Updated October 16, 2026 10:37 UTC

@BunsDev
BunsDev merged commit 07b9298 into main Oct 16, 2026
13 checks passed
@BunsDev
BunsDev deleted the notes-new-workspace-once branch October 16, 2026 10:38

This branch was successfully deployed

1 active deployment
Preview — a1a9fd55 Deployed Oct 16, 2026 by vercel[bot]
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