Open the related row, not the parent collection, from a relation chip#209
Merged
Conversation
The frontend builds row URLs as <slug>-<id> elsewhere; carrying the target row's slug in the relation payload lets relation consumers do the same without an extra lookup. Existing keys are unchanged.
Introduces DocumentPeekProvider at app scope so a peek (side panel or center modal) can host any row regardless of which collection it belongs to, and survives route changes. Nothing calls openDocument yet; this only adds the scaffolding. CurrentViewModeContext lets future callers (chips inside a peek, cells inside a collection table) read the mode of their surrounding surface. rowRoute / rowHref in relationUtils mirror the existing collection helpers but produce the document URI (no `collection/` prefix), ready for the relation chip to consume in a follow-up commit.
CDV stops owning openRowId, the runDetailTransition orchestrator, the side↔modal animation and the RowDetailView render. requestOpenRow and openRowInMode now call openDocument with a source that carries the visible row list (for next/prev), a refresh hook (autosave, restore), and onModeChange (so the in-peek mode toggle still persists to view.rowDetailMode for this view). CurrentViewModeProvider wraps the table so relation chips inside a cell inherit the configured row detail mode. Close-on-delete now calls closeDocument. Behavior is identical for clicks inside a collection table except that the peek now survives navigating to another collection, which is the whole point of moving it up.
RelationReferences now calls openDocument on click, with rowHref as the native anchor target so Cmd/middle-click still opens the row URL in a new tab. The mode comes from CurrentViewModeContext (the surrounding table's rowDetailMode, or the open peek's mode), so the chip respects "how I like to see rows here" without inventing a new preference. DocumentPeekHost moves to its own file so action-only consumers (chips, collection cells) don't drag RowDetailView and the editor stack into their module graph. The block editor preview of a data-view block also mounts CollectionDataViews outside the app shell, so the action and state hooks fall back to safe no-ops when no provider is present. runTransition captures hasPendingEdits and source.refresh before flushing, then calls refresh after the apply so a close-with-flush still refreshes the table even though RowDetailView has unmounted by the time autosave's onSaved would fire. tests/js/setup.js polyfills TextEncoder/TextDecoder from node:util so the tanstack router stack imports cleanly under jsdom. tech-debt notes #37 and #43 pick up the new chip path, the rowRoute / rowHref helpers, and the slug hydration in RowsController.
collectionHref, collectionRoute and navigateToCollection were the old chip path; the row helpers replaced them and nothing in src/ or tests/ still imports them. topWindow goes with them since nothing else used it.
Performance vs mainWorkload changed in 2 scenarios. 7 scenarios with notable timing changes.
Full numbers in the job summary. |
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
Relation chips now open the row they point to. A regular click uses the current detail mode: side peek, center modal, or full page. Cmd-click and other modified clicks still work like normal links.
Why
Clicking a relation chip should take you to that row, not back to its parent collection.
How
Row peek state now lives in the app shell, so table rows and relation chips use the same detail view. If you open a peek from one collection and then move to another, the peek stays open.
Relation refs now include row slugs, so chip URLs and full-page mode point at the row instead of the collection.
Testing Instructions
<slug>-<id>with nocollection/segment.Screen recording
Grabacion.de.pantalla.2026-05-19.a.las.12.10.16.mov