Skip to content

A thread on a keyed datum falls out of its row whenever the source is replaced #1146

Closed

Description

@max-sixty

A widget renders rows from a bound data source with projectData(root, records, keyOf, render, { snapshot }), keyed by a stable row id. A comment thread anchored on one row stays exact only within the source revision that row was projected from. Replacing the source value marks the thread outdated and drops it out of the row, back to the section. This happens even when the row keeps its key and only its other fields change.

Expected: a thread on a keyed datum stays exact while the key survives the replacement. The package reference asks that keys "remain with the same logical datum across refreshes", so the key already names the datum across revisions.

Repro

  1. Declare a contract with records: { items: "rows", key: "id" } over { rows: [{ id, label, updated }] }, and bind a widget to it that projects rows keyed by id, passing the watchData delivery as snapshot.
  2. Serve the page and comment on row a.
  3. Run leaf data set with a value in which row a differs only in updated.
  4. The thread is now outdated and no longer shows in row a.

Workaround in use: a second source that carries only the ids and changes only when a row joins or leaves. The widget projects from that source and paints from the full one. This keeps threads in place, but every widget over live data then needs two sources and two contracts, and the producer has to publish both.

Ask: let an anchor on a keyed datum follow its key across revisions of the source, perhaps for contracts that declare records.key, rather than pinning it to the revision it was made against.

Seen on leaf 574609a.

This was written by Claude Code on behalf of max-sixty

Activity

  1. added
    enhancement
    on Sep 25, 2026
  2. leaf-agent commented on Sep 25, 2026

    @leaf-agent
    Collaborator

    This is a real gap between the keyed-record contract and thread placement. The package contract asks projectData keys to stay with the same logical datum, but also specifies that a comment on a bound source becomes outdated at the next source revision. Anchor resolution applies that revision check before resolving the surviving key; the existing browser test asserts the resulting outdated state.

    The useful change is to let a declared records.key establish continuity for a row anchor when that key is still present, while keeping revision-scoped behavior for data without that declaration. The projection key is currently supplied by package code, so the implementation also needs to establish that it is the contract's row key before treating the two as the same identity. This issue tracks that product-level change; I have not opened a fix PR from triage.

  3. added a commit that references this issue on Sep 26, 2026
    61e6d1a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions