Repository navigation
fix: update meeting title component on meetingTitleUpdate - #195
Conversation
There was a problem hiding this comment.
Superseded by the review of
bc4e3341.
This review, of dd393cb8
💬 Approved with comments — The fix is small and correct. There is one optional robustness suggestion about duplicate listener registration, and the new subscription logic has no spec test.
Findings: 1 info · 1 suggestion
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
📋 Code Quality: 💬 1 info · 1 suggestion
The listener wiring is correct on the normal connect, update and disconnect path. Two minor points: a missing regression test, and a possible duplicate listener in an edge case.
Recommendation: 💬 Optional Nits
- [INFO] No spec test covers the new
meetingTitleUpdatesubscription: the title updating, themeetingprop swap, and listener removal on disconnect. (packages/core/src/components/rtk-meeting-title/rtk-meeting-title.tsx:45) - [SUGGESTION] If
meetingchanges while the component is detached and it is then attached again, the same listener is registered twice and one copy is never removed. Removing the listener from the current meeting beforeaddListenerwould make this safe. (packages/core/src/components/rtk-meeting-title/rtk-meeting-title.tsx:49)
View full review
On the normal path the listener wiring is correct:
connectedCallbacksets the initial title and adds the listener.- The
meetingwatcher moves the listener from the old meeting to the new one. disconnectedCallbackremoves the listener.
Possible duplicate listener (rtk-meeting-title.tsx:33-50)
meetingChangedadds a listener and never removes one from the current meeting first.- If
meetingis replaced while the component is detached, the watcher adds a listener to the new meeting. When the component is attached again,connectedCallbackadds the same listener a second time. - EventEmitter-style APIs allow the same handler to be registered twice, and each
removeListenercall removes only one copy, so one copy stays behind after the next disconnect. - The handler only sets the title, so registering it twice changes nothing on screen, but the leftover copy is a small leak.
- Fix: call
meeting?.meta?.removeListener('meetingTitleUpdate', this.titleUpdateListener)before theaddListenercall. Thertk-clockcomponent's watcher does the same by disconnecting first.
No spec test for the new subscription. A spec could mount the component with a mock meeting.meta, emit meetingTitleUpdate, and check two things: that the rendered title changes, and that the listener is removed when meeting is swapped or the component is detached.
✅ All other checks passed
📝 Documentation: ✅ LGTM
No documentation issues found.
Reviewed commit: dd393cb8
|
LGTM! |
dd393cb to
bc4e334
Compare
There was a problem hiding this comment.
💬 Approved with comments — The fix is correct and the earlier duplicate-listener suggestion is resolved. One INFO note remains: no spec test covers the new subscription.
Findings: 1 info
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
📋 Code Quality: 💬 1 info
The duplicate-listener issue is fixed. The meetingTitleUpdate subscription still has no spec test.
Recommendation: 💬 Optional Nits
- [INFO] No spec test covers the new
meetingTitleUpdatesubscription: the title updating, themeetingprop swap, and listener removal on disconnect. (packages/core/src/components/rtk-meeting-title/rtk-meeting-title.tsx:45)
View full review
- Fixed:
meetingChangednow callsremoveListeneron the current meeting (rtk-meeting-title.tsx:49) before it callsaddListener(line 50). Attaching the component again aftermeetingchanged while it was detached no longer registers the handler twice.disconnectedCallbackremoves the listener, so everyaddListenerhas a matchingremoveListener. - Still open (INFO): there is no spec in
packages/core/src/components/rtk-meeting-title/. A spec with a mockmeeting.metacould check three things:- the title re-renders when
meetingTitleUpdateis emitted; - the listener moves to the new meeting when the
meetingprop is swapped; - the listener is removed on disconnect.
- the title re-renders when
- The
@cloudflare/realtimekitversion bump is the same inpackages/core/package.jsonandpackage-lock.json.
✅ All other checks passed
📝 Documentation: ✅ LGTM
No documentation issues found.
Reviewed commit: bc4e3341
|
LGTM! |
|
🎉 This PR is included in version 2.0.4-staging.3 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Description
This PR makes the meeting title component udpate itself on the event
meetingTitleUpdateScreenshots