Repository navigation
feat: expose the room's collaborator count as JS hooks - #503
Conversation
🚩 New public surfaces
|
🛝 WordPress PlaygroundsBuilt from 967a146
|
Codecov Report❌ Patch coverage is ❌ Your patch check has failed because the patch coverage (79.31%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #503 +/- ##
============================================
- Coverage 95.92% 95.74% -0.19%
Complexity 255 255
============================================
Files 21 21
Lines 3071 3076 +5
============================================
- Hits 2946 2945 -1
- Misses 125 131 +6
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
presence-heartbeat-collaborators (#451) only reached presence-ping.js's own tick handler. wp.hooks lets external code, like Gutenberg's sync poll loop, react to a room's editor count instead of polling for it.
0624271 to
45e1a17
Compare
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
There was a problem hiding this comment.
🟡 Changes recommended
Cross-site tab coordination can emit another multisite site's collaborator count.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Exposes room and collaborator-state changes through JavaScript hooks for integrations such as Gutenberg sync.
Changes:
- Adds
watchingRoomand edge-triggeredcollaboratorsChangedactions. - Passes the editor room to JavaScript and adds
wp-hooks. - Adds documentation and PHPUnit/Playwright coverage.
File summaries
| File | Description |
|---|---|
assets/js/presence-ping.js |
Emits the new JavaScript actions. |
includes/heartbeat.php |
Supplies room configuration and hook dependency. |
tests/test-heartbeat.php |
Tests configuration and dependency wiring. |
tests/e2e/presence-collaborator-hooks.test.js |
Tests action behavior. |
README.md |
Documents the actions. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: josephfusco <6676674+josephfusco@users.noreply.github.com>
Co-authored-by: josephfusco <6676674+josephfusco@users.noreply.github.com>
i-am-chitti
left a comment
There was a problem hiding this comment.
LGTM 🚀, two minor suggestions.
Fixes #502
presence-ping.jsnow firespresence-api.watchingRoom(once, before Heartbeat's first tick) andpresence-api.collaboratorsChanged(on the 1-to-2+ and 2+-to-1 edges) throughwp.hooks. External code, like Gutenberg's sync poll loop, can react to a room's editor count instead of polling for it separately. Covered by new PHPUnit and Playwright tests, and documented in the README's JS Actions section.Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Sonnet 5
Used for: Implementation (PHP config plumbing, JS event wiring, PHPUnit and Playwright tests) and README docs, drafted end to end and reviewed by me.