fix(collaboration-caret): guard against null awareness state values#7740
Merged
bdbch merged 5 commits intoJun 1, 2026
Merged
Conversation
🦋 Changeset detectedLatest commit: 641c59d The changes in this PR will be included in the next version bump. This PR includes changesets to release 72 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Deploy Preview for tiptap-embed ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
There was a problem hiding this comment.
Pull request overview
Guards the CollaborationCaret awareness-state mapping against null/undefined values to avoid runtime crashes when a collaboration client disconnects and leaves transient empty awareness entries.
Changes:
- Add a runtime guard in
awarenessStatesToArrayto handle falsy awareness state values safely. - Add a Vitest unit test covering
null,undefined, and valid awareness-state entries. - Add a changeset for a patch release of
@tiptap/extension-collaboration-caret.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/extension-collaboration-caret/src/collaboration-caret.ts | Avoids spreading from a missing awareness state by returning { clientId } for falsy entries. |
| packages/extension-collaboration-caret/tests/collaboration-caret.spec.ts | Adds coverage to ensure null/undefined awareness entries don’t crash and yield minimal user objects. |
| .changeset/fix-collab-caret-null-awareness.md | Records a patch-level user-facing fix for the crash scenario. |
bdbch
requested changes
Apr 18, 2026
26f1a79 to
496de57
Compare
bdbch
approved these changes
May 8, 2026
bdbch
requested changes
May 13, 2026
bdbch
previously approved these changes
Jun 1, 2026
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.
Changes Overview
Guard against null/undefined awareness state values in
awarenessStatesToArrayto prevent runtime errors when a collaboration client disconnects.Implementation Approach
Added a null check on the
valuebefore spreadingvalue.user. Whenvalueis falsy, onlyclientIdis returned.Testing Done
Added a unit test covering
null,undefined, and valid awareness state entries in a single Map. All 4 tests pass.Verification Steps
pnpm vitest run packages/extension-collaboration-caretpnpm lint && pnpm buildAdditional Notes
None.
Checklist
Related Issues
None.