Skip to content

Address collaborative document presence change detection and debounce#23760

Open
akabiru wants to merge 1 commit into
devfrom
bugfix/live-events-awareness-presence-key
Open

Address collaborative document presence change detection and debounce#23760
akabiru wants to merge 1 commit into
devfrom
bugfix/live-events-awareness-presence-key

Conversation

@akabiru

@akabiru akabiru commented Jun 15, 2026

Copy link
Copy Markdown
Member

Two latent bugs in the collaborative-document presence controller (live-events.controller.ts), which renders connected-user avatars from the Yjs awareness protocol. The change-detector keyed its presence map by array index instead of state.clientId, so it only noticed when the user count changed and missed same-count membership swaps (one peer leaving as another joins) — leaving stale avatars; and the refresh debounce named a non-existent method (triggerUpdateUI vs the real triggerUpdateUsersUI), so every awareness frame fetched immediately instead of throttling to 1s. Both fixed by keying on the real client id and pointing the debounce at the correct method.

Key the presence map by the real Yjs client id so the set-difference
check detects identity swaps that keep the user count constant, and
point the stimulus-use debounce at the method it actually wraps so
avatar refreshes are throttled as intended.
@github-actions

Copy link
Copy Markdown

Warning

Flaky specs

  • rspec ./modules/my_page/spec/features/my/work_package_table_spec.rb[1:1:1]

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes two issues in the collaborative document live-events Stimulus controller that caused connected-user avatar presence to become stale and avatar refreshes to run without the intended debounce.

Changes:

  • Fixes the Stimulus-use debounce configuration by targeting the actual triggerUpdateUsersUI method.
  • Corrects presence change detection by keying currentUsers by the awareness state’s clientId instead of the array index.

@akabiru akabiru changed the title Bugfix: Fix collaborative document presence change detection and debounce Adress collaborative document presence change detection and debounce Jun 15, 2026
@akabiru akabiru changed the title Adress collaborative document presence change detection and debounce Address collaborative document presence change detection and debounce Jun 15, 2026
@akabiru akabiru self-assigned this Jun 15, 2026
@akabiru akabiru added this to the 17.6.x milestone Jun 15, 2026
@akabiru akabiru requested a review from brunopagno June 15, 2026 17:13
@akabiru akabiru marked this pull request as ready for review June 15, 2026 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants