fix(#244): restore role-aware initial result views for saved and shared queries - #251
Merged
Merged
Conversation
…ed queries Opening a Filter-role query from the Library, or via a share link/OAuth handoff, now always starts in the Filter preview regardless of the previously active result view or a dormant persisted spec.view. Both call sites resolve the same rolePreviewView(spec) || queryView(query) precedence so the invariant can't diverge between callers again. Folds in #249, whose finding (a Filter-role query with non-auto-runnable SQL, and the broader share-link bootstrap gap for any SQL-bearing shared query) is now covered here instead of tracked separately. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PQbDSVDUTUk1bA8891cX9y
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 free
to 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 & why
Opening a Filter-role saved query from the Library, or via a share link/OAuth handoff, previously did not reliably start in the Filter preview:
src/ui/saved-history.js): a Filter-role query with SQL restored whichever result view (Table/JSON/Panel) was already active, and could be overridden by a dormant persistedspec.view/Panel config. A Filter-role entry whose SQL can't auto-run (empty/DDL — reachable via an import or legacy localStorage entry that bypassedfilterSqlDiagnostics) fell through to no view change at all — a real gap surfaced independently by 4 of 8 code-review finder angles during this PR's own review.src/main.js):resultViewwas only ever restored for a queryless Panel link (if (panel && panel.cfg) { if (!shared.sql) ... }). Any SQL-bearing shared Filter query, or a SQL-bearing shared Panel query with a persistedspec.view, always landed on the default Table view regardless of role or persisted view.Both call sites now resolve the same precedence via one shared pure helper (
rolePreviewViewinsrc/core/result-choice.js):The Filter preview stays transient (no
spec.view: "filter"is ever persisted), dormant Panel state is never touched, and ordinary reruns after a query is open continue to preserve the user's current Table/JSON/Filter selection.Closes #244. Folds in #249 (closed as a duplicate) — that issue's narrower repro (empty-SQL Filter query) and the broader share-link restoration gap it pointed at are both covered here with one helper instead of two independent implementations that could diverge.
Verification
npm test: 2761/2761 passing,src/core/result-choice.jsandsrc/main.jsat 100/100/100/100,src/ui/saved-history.jsabove the branches floor./code-review(high effort, 8 finder angles + verify pass) run on the initial Library-only diff; the confirmed finding was fixed in this same PR before opening it, and the resulting broader share-link gap was triaged into this issue's scope per user direction rather than filed separately.Checklist
npm testpasses (the per-file coverage gate is non-negotiable)npm run buildsucceeds (single-filedist/sql.html)src/core/, network insrc/net/(injected fetch), DOM insrc/ui/CHANGELOG.md([Unreleased]) updated🤖 Generated with Claude Code
https://claude.ai/code/session_01PQbDSVDUTUk1bA8891cX9y