Skip to content

feat(views): track View sources independently of Data Links - #454

Open
allison-truhlar wants to merge 9 commits into
ngviews-07-cart-and-viewer-polishfrom
ngviews-08-broken-source-tracking
Open

allison-truhlar wants to merge 9 commits into
ngviews-07-cart-and-viewer-polishfrom
ngviews-08-broken-source-tracking

Conversation

@allison-truhlar

Copy link
Copy Markdown
Collaborator

Dev-feedback branch 08 (items 1-4 of the 3.3.0a0 test-release feedback). Spec: docs/superpowers/specs/2026-09-16-ngviews-dev-feedback-design.md.

What changed

  • Item 1 (bug): finding dependent Views used DISTINCT over the JSON ng_state column, which 500s on Postgres. Replaced with an IN subquery.
  • Item 3: view_layers gains fsp_name and path (migration 7c3e9a2d5b41, with backfill from the current Data Link), recorded at View creation. Before this a layer knew its source only through data_link_id, so deleting the link lost the path.
  • Item 2: the Views table keeps broken sources visible, with a broken-link icon and a "Data link deleted" tooltip, instead of dropping them.
  • Item 4: the Data Link delete dialog lists dependent Views up front (one-click flow) instead of after a 409 round trip, and refetches Views after delete.

Also includes the spec and plans for branches 08/09/10.

Testing

Backend and frontend suites green. Migration verified on a populated scratch SQLite.

@allison-truhlar
allison-truhlar added this pull request to stack #429 September 22, 2026 17:57
…Views

Postgres cannot compare json columns, so JOIN + DISTINCT failed with 500 on
Data Link delete. Filter by an IN-subquery over view_layers.view_id instead.
Layers previously knew their source only through data_link_id, which is
nulled when the Data Link is deleted. Store the source directly so broken
Views keep showing (and can later be restored by) their path. Backfills
existing linked layers.
…k icon

Sources now come from layer.fsp_name/path instead of a lookup through the
user's Data Links, so a deleted link no longer erases the source line.
Add coverage for the broken-state merge across layers sharing one source
and for the em-dash fallback when no layer resolves to a source. Also
simplify the broken-link icon to use FgIcon's built-in label prop instead
of a hand-built aria-label span.
…alog

Pre-fetch with useViewsForDataLinkQuery so the warning renders on open and
one click deletes with confirm. The 409 path stays as a race fallback.
…te dialog

Final-review fix wave for ngviews-08-broken-source-tracking:
1. Sources cell no longer treats an empty-string path (FSP-root Data Link) as
   an unknown source; only fsp_name/path === null skips a layer.
2. Sources cell reuses datasetKey() from pathHandling instead of a hand-rolled
   `${fsp_name}::${path}` key.
3. Broken-link FgIcon uses the color="error" prop instead of a raw className.
4. Tooltip copy now reads "...won't appear in this View." (capital V),
   matched in the spec and plan docs.
5. ngViewsColumns test fixtures use the mocked "nrs" FSP with FSP-relative
   paths so the prefixed display path is actually exercised; added a case
   for an empty-string (FSP-root) path.
6. Removed the dead @/queries/proxiedPathQueries mock from NGViews.test.tsx.
7. Delete button in the Data Link delete dialog is disabled while the
   dependent-Views pre-fetch is in flight.
…n-source tooltip

Deleting a Data Link only invalidated the proxied-path queries, so the
Views table kept its cached layers (30s staleTime) and the broken-link
icon did not appear until a page reload. Invalidate the Views queries in
the delete mutation's onSuccess.

Tooltip now reads: "Data link deleted; source no longer appears in View".
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