Skip to content

feat(vc-app): detect and retrofit table URL-query state in existing apps#249

Merged
maksimzinchuk merged 1 commit into
mainfrom
feat/table-url-state-skill
Jun 25, 2026
Merged

feat(vc-app): detect and retrofit table URL-query state in existing apps#249
maksimzinchuk merged 1 commit into
mainfrom
feat/table-url-state-skill

Conversation

@maksimzinchuk

Copy link
Copy Markdown
Collaborator

Summary

Adds a path for opting an existing VcDataTable list into URL-query state persistence — sort, search keyword, and current page — via the state composables' stateKey option, 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 on VcDataTable but not yet persisting their view.

Changes

@vc-shell/migrate

  • New diagnostic transform table-url-state-audit that flags:
    • lists using useDataTableSort / useDataTablePagination / useTableSearch without any stateKey;
    • the deprecated useTableQueryState / useTableQueryPersistence preview API;
    • searchable VcDataTables whose keyword is not owned by useTableSearch.
  • Registered in the transform registry (introducedIn: 2.1.0, diagnostic-only, after the pagination audit).
  • Surfaced as a "Table URL State Persistence" topic in MIGRATION_REPORT.md.
  • Unit tests for the new transform.

@vc-shell/vc-app-skill

  • New migration prompt table-url-state-migration.md with the full retrofit rules: one shared stateKey across the three composables, page reset on search (pagination.setPage(1)), seeding the initial load from pagination.skip, converting event-driven @search to v-model:search-value + watcher, threading stateKey through composable-owned pagination, and removing the deprecated preview API.
  • Registered the topic in the migrate topic map (vc-app.md) and the migration-agent processing order.

Test plan

  • cli/migrate: tsc + tsc --noEmit clean; full suite green (45 files / 241 tests, incl. the new transform test).

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.
@github-actions

Copy link
Copy Markdown

📦 Preview published for commit 0229549

Install the preview with dist-tag:

npm install @vc-shell/framework@pr-249

Or pin to the exact commit:

npm install @vc-shell/[email protected]

Published packages (dist-tag pr-249, version 2.1.0-pr249.0229549):

  • @vc-shell/framework
  • @vc-shell/api-client-generator
  • @vc-shell/create-vc-app
  • @vc-shell/config-generator
  • @vc-shell/migrate
  • @vc-shell/ts-config
  • @vc-shell/mf-config
  • @vc-shell/mf-host
  • @vc-shell/mf-module
  • @vc-shell/vc-app-skill

@maksimzinchuk maksimzinchuk merged commit c716dc7 into main Jun 25, 2026
10 checks passed
@maksimzinchuk maksimzinchuk deleted the feat/table-url-state-skill branch June 25, 2026 15:27
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.
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