Title: PR #327's ProseMirror widget keys omit cursor colour and name, so recycled cursor DOM goes stale · Issue #331 · developing-today/code · GitHub
Open Graph Title: PR #327's ProseMirror widget keys omit cursor colour and name, so recycled cursor DOM goes stale · Issue #331 · developing-today/code
X Title: PR #327's ProseMirror widget keys omit cursor colour and name, so recycled cursor DOM goes stale · Issue #331 · developing-today/code
Description: Finding Open draft PR #327 (⚡ Bolt: Optimize ProseMirror decoration recycling, head 59decd10f6) removes the decorationGeneration counter in pkgs/id/web/src/cursors.ts and gives the collaborative-cursor widgets stable, state-derived keys ...
Open Graph Description: Finding Open draft PR #327 (⚡ Bolt: Optimize ProseMirror decoration recycling, head 59decd10f6) removes the decorationGeneration counter in pkgs/id/web/src/cursors.ts and gives the collaborative-cu...
X Description: Finding Open draft PR #327 (⚡ Bolt: Optimize ProseMirror decoration recycling, head 59decd10f6) removes the decorationGeneration counter in pkgs/id/web/src/cursors.ts and gives the collaborative-cu...
Opengraph URL: https://github.com/developing-today/code/issues/331
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"PR #327's ProseMirror widget keys omit cursor colour and name, so recycled cursor DOM goes stale","articleBody":"## Finding\n\nOpen draft PR #327 (⚡ Bolt: Optimize ProseMirror decoration recycling, head `59decd10f6`) removes the `decorationGeneration` counter in `pkgs/id/web/src/cursors.ts` and gives the collaborative-cursor widgets stable, state-derived keys — but two of the new keys omit properties that are rendered into the widget DOM, so ProseMirror will keep showing the old DOM after those properties change.\n\nProseMirror compares a widget decoration's `key` instead of its DOM node to decide whether it needs to be redrawn (ProseMirror reference: widget spec `key` — \"When comparing decorations of this type (in order to decide whether it needs to be redrawn), ProseMirror will by default compare the widget DOM node by identity. If you pass a key, that key will be compared instead\"). A property that changes without changing the key therefore never reaches the screen.\n\n## Evidence (PR #327 head, cross-checked via `gh api contents?ref=59decd10f6`)\n\n- Standalone remote cursor, `cursors.ts:738` on the PR head:\n `key: cursor-${cursor.clientID}-o${cursor.opacity}-c${connectionState}`\n — includes opacity and connection state, but **not `cursor.color` and not `cursor.name`**. The widget it keys is built by `createStandaloneCursor` / `createCursorLine` (same file): caret `borderColor = cursor.color`, label `backgroundColor = cursor.color`, label text colour derived from `cursor.color`, and label `textContent = cursor.name`.\n- Cluster/merged cursor lines, `cursors.ts:715` on the PR head:\n `key: cursor-cluster-${group.position}-${clusterKey}-c${group.mostRecentColor}`\n — the merged bar appended to the leftmost line renders one segment per cursor with that cursor's `color` (background), `name` (text), `opacity` and connection-state-driven strobe state (`createMergedBar`), and non-leftmost group lines render their first cursor's opacity/strobe state (`createCursorLine`); none of those per-cursor values are in the key (`clusterKey` encodes only `clientID@head` per cursor, and `mostRecentColor` is only the owning group's first cursor's colour).\n- Contrast inside the same diff: the own-cursor key (`cursors.ts:651`) correctly includes its only rendered variable property, `ownCursor.color`. Contrast across the sibling drafts tracked by #310: PR #217's standalone key includes `-color-${cursor.color}`, its cluster key includes connection state plus an opacity hash, and its selection key includes colour — #327 drops colour from the standalone and selection keys.\n- Colour/name are not session constants in this code: the plugin's `apply()` \"update\" case replaces `color` on every cursor update and takes `name` from the update when present (`name = cursorUpdate.name ?? existing?.name`), and `createCursorDecorations` falls back to `getColorForClient(clientID)` only when an update carries no colour — so a peer's colour source/value and display name can both change mid-session. While a peer is active their opacity stays at 1.0 (see `getOpacityForAge` in `cursor-utils.ts`: 1.0 for the first 30s after each update, and every update refreshes `lastUpdate`), so no other key component forces a redraw either.\n\n## Why it matters\n\nIf #327 (or a variant with the same keys) merges as-is, a collaborator who changes colour or display name — or whose first updates arrive colourless and later carry an explicit colour — keeps rendering with the stale caret colour and stale name label for everyone else, indefinitely while they stay active. That is a correctness regression introduced specifically by removing the generation counter, in the one file the PR touches. The PR's own added learning note (`.jules/bolt.md`) states the rule it breaks: properties that dynamically dictate the widget's appearance (it names opacity, connectionState and colour) must be included in the key.\n\n## Acceptance criteria\n\n- [ ] Whichever ProseMirror-recycling PR survives the #310 triage, every widget key in `cursors.ts` covers all properties rendered into that widget's DOM: standalone cursor keys include colour and name; cluster keys include the per-cursor segment values (colour, name, opacity) and connection state, not just the group's most-recent colour.\n- [ ] The selection decoration's colour handling is checked the same way (PR #327's `selection-…-o${opacity}` key omits `cursor.color`, which is half of its rendered `background-color: ${cursor.color}${selectionOpacity}` style).\n- [ ] A test or equivalent check pins the key construction: changing only a cursor's colour (or only its name) produces a different standalone key. There is currently no `cursors.test.ts` (only `cursor-utils.test.ts`), so the key derivation may need extracting to a pure helper to be testable.\n\nFound by the pr-diff-review job reviewing PR #327 (open) in developing-today/code. Cross-repo check: `createCursorDecorations` / `collab-cursor` exist only in developing-today/code (GitHub code search), so this is a single-repo issue. Related triage: #310.\n","author":{"url":"https://github.com/dezren39","@type":"Person","name":"dezren39"},"datePublished":"2026-10-19T02:25:46Z","url":"https://github.com/developing-today/code/issues/331"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:673c46c9-a868-6da3-ccc5-c08f945879a5 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D2EA:249987:47342F:5FCCB9:6B062135 |
| html-safe-nonce | fc05af40e60fd62a524eaf8049512a64fe526fb34999ced0b380510a4b726ed1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMkVBOjI0OTk4Nzo0NzM0MkY6NUZDQ0I5OjZCMDYyMTM1IiwidmlzaXRvcl9pZCI6IjgyOTc4OTU4NzAxNDI0ODg4ODUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 2fea7cd025accda77c9cbda5b3fb6316f64c70bc8f5a06443306cb4fe37e5d03 |
| hovercard-subject-tag | issue:5916730266 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/developing-today/code/331/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1a1697c0c97e4a7552dae7ae146488907af207c7ecd31ec675e9878ead0908b6/developing-today/code/issues/331 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1a1697c0c97e4a7552dae7ae146488907af207c7ecd31ec675e9878ead0908b6/developing-today/code/issues/331 |
| og:image:alt | Finding Open draft PR #327 (⚡ Bolt: Optimize ProseMirror decoration recycling, head 59decd10f6) removes the decorationGeneration counter in pkgs/id/web/src/cursors.ts and gives the collaborative-cu... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dezren39 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9a7c5824b75ea2ec5e3de73a483229c7bb9f32a774ffd401f010dd9bacf1483d |
| turbo-cache-control | no-preview |
| go-import | github.com/developing-today/code git https://github.com/developing-today/code.git |
| octolytics-dimension-user_id | 26439447 |
| octolytics-dimension-user_login | developing-today |
| octolytics-dimension-repository_id | 627308783 |
| octolytics-dimension-repository_nwo | developing-today/code |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 627308783 |
| octolytics-dimension-repository_network_root_nwo | developing-today/code |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | b25c3080e84402f75431d8dc7a96b2635219cec7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width