feat(vc-app): detect and retrofit table URL-query state in existing apps#249
Merged
Conversation
Add a path for opting an existing VcDataTable list into URL-query state persistence (sort, search keyword, current page) via the composables' `stateKey` option, so the view survives a reload and travels in shareable links. - migrate: new diagnostic transform `table-url-state-audit` that flags lists without `stateKey`, the deprecated `useTableQueryState` preview API, and searchable tables whose keyword is not owned by `useTableSearch`; registered (introducedIn 2.1.0) and surfaced as a "Table URL State Persistence" topic in the migration report. - vc-app-skill: new `table-url-state-migration` prompt with the full retrofit rules (shared stateKey across the three composables, page reset on search, seeding the initial load from pagination.skip, @search-event to v-model conversion, removing the deprecated preview API); registered in the migrate topic map and the migration-agent processing order. The list-blade generator already emits this wiring, so newly scaffolded lists include URL state by default.
|
📦 Preview published for commit Install the preview with dist-tag: npm install @vc-shell/framework@pr-249Or pin to the exact commit: npm install @vc-shell/[email protected]Published packages (dist-tag
|
maksimzinchuk
added a commit
that referenced
this pull request
Jun 26, 2026
…ook story (#250) ## Summary Follows up [#249](#249) with user-facing documentation for the table URL-query state feature. ## Docs (`vc-data-table.docs.md`) - Completed the **URL query persistence** example: the reload watcher now covers all query dimensions (`[sortExpression, searchValue, () => pagination.skip]`), not just sort. - Added the required `watch(searchValue, () => pagination.setPage(1))` with a **warning** explaining the pitfall it prevents: searching from a later page leaves a stale `_page` in the URL, so a reload requests a page beyond the filtered result set and renders an empty "nothing found" state. - Added a tip for **composable-owned pagination** (thread `stateKey` through; seed the initial load from `pagination.skip`). - New **Common Mistake #9** — "Not resetting the page when the search changes" with wrong/correct snippets. ## Storybook (`vc-data-table.stories.ts`) - New **`WithUrlStatePersistence`** story. The per-blade query service is normally provided by the blade layer; the story provides an in-memory stand-in (`provide(TableQueryStateKey, ...)`) so the `stateKey` round-trip is visible: a live query string updates as you sort/search/page, and a **Remount table** button proves the state restores exactly as a page reload would from the URL. Includes the page-reset-on-search watcher. ## Test plan - `yarn typecheck` — clean. - `yarn docs:lint` — 0 errors. - `eslint` on the story — clean.
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.
Summary
Adds a path for opting an existing
VcDataTablelist into URL-query state persistence — sort, search keyword, and current page — via the state composables'stateKeyoption, so a list view survives a reload and travels in shareable links.Generation of new lists already emits this wiring (the
list-blade-generator/list-blade-pattern). This PR closes the gap for apps that are already onVcDataTablebut not yet persisting their view.Changes
@vc-shell/migratetable-url-state-auditthat flags:useDataTableSort/useDataTablePagination/useTableSearchwithout anystateKey;useTableQueryState/useTableQueryPersistencepreview API;VcDataTables whose keyword is not owned byuseTableSearch.introducedIn: 2.1.0, diagnostic-only, after the pagination audit).MIGRATION_REPORT.md.@vc-shell/vc-app-skilltable-url-state-migration.mdwith the full retrofit rules: one sharedstateKeyacross the three composables, page reset on search (pagination.setPage(1)), seeding the initial load frompagination.skip, converting event-driven@searchtov-model:search-value+ watcher, threadingstateKeythrough composable-owned pagination, and removing the deprecated preview API.vc-app.md) and the migration-agent processing order.Test plan
cli/migrate:tsc+tsc --noEmitclean; full suite green (45 files / 241 tests, incl. the new transform test).