Repository navigation
cli: sync input filters with the URL in dev/serve - #3338
Closed
wiwimaster wants to merge 1 commit into
Closed
wiwimaster wants to merge 1 commit into
wiwimaster wants to merge 1 commit into
Conversation
The Filter class already supports reading an input's initial value from the page URL and writing user choices back (see core/src/FILTER_SYSTEM.md, 'Preview' context). The CLI renderer never wired that up: CLIPageWrapper created the page filters context without url/updateUrl deps, so `?category=Electronics` was ignored in `evidence dev` and `evidence serve`, and choosing a value did not update the address bar. Drill-through links from a table (`link` column pointing at `/detail?id=…`) therefore landed on the detail page without a selection, and filtered views could not be shared by URL when self-hosting. - CLIPageWrapper: pass `url` (window.location on the client) and `updateUrl` (history.replaceState) to createPageFiltersContext, the same pattern the published/preview routes use. - process(): accept the request URL as an option and hand it to the server-side Filters, so SSR renders the state the client restores. - Both page.server loads pass their request `url` through. Verified against a BigQuery project: opening `/page?filter_id=value` pre-selects the dropdown, selecting an option rewrites the query string, `pnpm --filter @evidence/cli check` and the CLI unit tests pass. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
@wiwimaster is attempting to deploy a commit to the Evidence Team on Vercel. A member of the Team first needs to authorize it. |
Member
|
@wiwimaster this should be solved in 0.10.0 - let me know if that's working for you! Closing this PR for now, but feel free to reopen if it's not working for you |
Contributor
Author
|
Thanks @hughess, confirmed: with |
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.
Problem
The
Filterclass supports reading an input's initial value from the page URL and writing user choices back (documented incore/src/FILTER_SYSTEM.md; the Preview context is listed as "reads: yes, writes: yes"). The CLI renderer never wired that up:CLIPageWrappercreates the page filters context withouturl/updateUrldeps, so inevidence devandevidence serve?category=Electronicsin the address bar is ignored, andFor self-hosters this means table drill-throughs (a
linkcolumn pointing at/detail?id=…) land on the detail page without a selection, and filtered views cannot be shared by URL.Change
url(window.location.hrefon the client) andupdateUrl(history.replaceState) tocreatePageFiltersContext, the same pattern the published/preview routes use.urlas an option and hand it to the server-sideFilters, so SSR renders the same state the client restores from the URL.+page.server.tsloads pass their requesturlthrough.18 insertions, no new dependencies.
Verification
Against a project with a BigQuery direct connector, running the CLI from source (
bun cli/cli/index.ts --project … dev):/detail?post_id=395196pre-selects that option in the{% dropdown id="post_id" %}and the page queries render for it;?post_id=9;pnpm --filter @evidence/cli checkpasses; CLI unit tests: 18 files, 340 tests passed.🤖 Generated with Claude Code