Skip to content

fix: keep watches panel populated when switching to a non-spicedb tab#71

Open
ivanauth wants to merge 1 commit into
authzed:mainfrom
ivanauth:fix/issue-63-preserve-watches-panel-on-tab-switch
Open

fix: keep watches panel populated when switching to a non-spicedb tab#71
ivanauth wants to merge 1 commit into
authzed:mainfrom
ivanauth:fix/issue-63-preserve-watches-panel-on-tab-switch

Conversation

@ivanauth

@ivanauth ivanauth commented May 13, 2026

Copy link
Copy Markdown
Contributor

Closes #63.

`onDidChangeActiveTextEditor` was unconditionally calling
`performUpdate` whenever the active editor changed. When the new editor
was anything other than a `.zed` / `.zed.yaml` / spicedb-tagged file,
`performUpdate` fell through to posting `setActiveSchema(null, null)`
and `setActiveYaml(null, null)`. The webview then flipped its
`isValidFile` flag and rendered the "current editor is not viewing a
SpiceDB schema" empty state, hiding the previously-visible watches.

Skip the call when the new editor isn't a SpiceDB-related document, so
the panel keeps the state of whichever SpiceDB file was last viewed.
The predicate matches the one already used in the `'ready'` handler and
in the webview's own validity check, factored out as a small pure
function (`isSpiceDbDocument`) so the same logic is shared by both call
sites and is unit-testable without the VS Code test harness.

Closes authzed#63.
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.

check watches panel clears out when switching tabs

1 participant