Edit-mode replace affordance for broken singular linksTo#4992
Conversation
The plural `linksToMany` view path and both link editors (standard + compact) now read `getRelationship` once per render and dispatch `BrokenLinkTemplate` for each slot whose relationship is `error` or `not-found`; present, not-loaded, and not-set slots keep their existing per-item render. Each placeholder occupies its own item container, so one broken element no longer breaks the surrounding list. Stability is preserved by leaving the iteration keying untouched — the view path still keys on the stable per-child component identity and the editors on their index / box identity. The broken-link state only feeds an inner branch, and the relationship read is pure (it never retriggers the lazy loader) and returns a fresh array that is never used as an each key. This keeps per-slot identity stable when state hasn't changed, so a sibling field staying focused mid-edit is never torn down by a broken neighbor. In edit format a broken element shows the placeholder plus the existing remove affordance, so a dead reference is visible and clearable rather than rendering as a broken card. `BrokenLinkTemplate` now accepts splattributes so callers can attach per-element hooks/attributes to the placeholder root. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…n-link-placeholder-per-element-in-linkstomany
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
In edit mode a broken singular linksTo now surfaces, alongside the placeholder and remove control, a "Link [type]" button that opens the card chooser to swap the broken reference for a working one in a single step instead of first reverting to the empty state. The broken state stays distinct from the never-set state: a never-set link shows only the bare "Link" button, while a broken link shows the URL plus remove and replace controls. Both affordances are hidden when the editor is read-only. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds a “replace” affordance for broken singular linksTo fields in edit mode, allowing users to swap a broken reference for a valid one via the card chooser without first clearing the field. This aligns singular linksTo broken-state UX more closely with the existing plural handling and clarifies the distinction between “never set” vs “broken”.
Changes:
- Render a “Link [type]” replace button alongside the broken-link placeholder and remove control (writeable only).
- Stack broken-state controls in the trailing column next to the placeholder.
- Expand integration coverage to assert broken edit-mode controls, remove→empty transition, and read-only behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/base/links-to-editor.gts | Adds replace button to broken-link edit state and stacks remove/replace controls; includes styling. |
| packages/host/tests/integration/components/linksto-broken-link-placeholder-test.gts | Adds/updates tests verifying broken edit UI shows placeholder+URL+remove+replace, removal returns to empty “Link” state, and read-only hides controls. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The preview stays visible in the PR comment via the commit-pinned raw URL. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The preview stays visible in the PR description via the commit-pinned raw URL. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Preview deploymentsHost Test Results 1 files 1 suites 1h 47m 53s ⏱️ Results for commit db32d6c. Realm Server Test Results 1 files 1 suites 10m 58s ⏱️ Results for commit db32d6c. For more details on these errors, see this check. |
lukemelia
left a comment
There was a problem hiding this comment.
It would be good to review this with design team after it lands.
What
In edit mode, a broken singular
linksTonow offers a replace affordance: a "Link [type]" button rendered alongside the broken-link placeholder and the remove control. Clicking it opens the card chooser and swaps the broken reference for a working one directly, without first removing the link to fall back to the empty state.The broken state stays visually distinct from the never-set state:
error/not-found) — the placeholder with the URL surfaced, a remove (X) control, and the "Link [type]" replace control.Both write controls are hidden when the editor is read-only; the placeholder and its URL still render so the broken target stays visible.
Preview
Singular
linksTo(with the new replace button) and plurallinksToMany(broken slot keeps its drag handle + remove among present cards) in edit mode:Where
packages/base/links-to-editor.gts— the broken branch ofLinksToEditorgains the replace button, stacked with remove in the trailing controls column.Tests
packages/host/tests/integration/components/linksto-broken-link-placeholder-test.gts:Plural
linksToManyedit-mode handling (per-slot placeholder + remove) is carried by #4983, which this PR is stacked on.CS-11227