replace leave lobby popup with custom popup#4449
Conversation
Walkthrough
ChangesAsync modal close confirmation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/client/Navigation.ts (1)
134-149: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winDo not call
leaveLobby()beforeclose()here.Line 143 already dispatches the leave event for
HostLobbyModal, and Line 149 then triggersHostLobbyModal.onClose(), which dispatchesleave-lobbyagain on Line 561 insrc/client/HostLobbyModal.ts. That makes backdrop/main-click dismissal send the same leave action twice.Suggested fix
- // Call leaveLobby or closeAndLeave first if it exists (for lobby modals) - if (typeof openModal.leaveLobby === "function") { - openModal.leaveLobby(); - } else if (typeof openModal.closeAndLeave === "function") { + // Let the modal own its teardown in onClose()/closeAndLeave(). + if (typeof openModal.closeAndLeave === "function") { openModal.closeAndLeave(); return; // closeAndLeave already calls close() } openModal.close();🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/client/Navigation.ts` around lines 134 - 149, The modal dismissal flow in Navigation should not invoke leaveLobby before close for HostLobbyModal, because close already routes through HostLobbyModal.onClose and re-dispatches the leave action. Update the openModal handling so that backdrop/main-click dismissal relies on close() for HostLobbyModal, while preserving the existing confirmBeforeClose and closeAndLeave behavior; use the openModal.close, openModal.leaveLobby, openModal.closeAndLeave, and HostLobbyModal.onClose paths to locate the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@src/client/Navigation.ts`:
- Around line 134-149: The modal dismissal flow in Navigation should not invoke
leaveLobby before close for HostLobbyModal, because close already routes through
HostLobbyModal.onClose and re-dispatches the leave action. Update the openModal
handling so that backdrop/main-click dismissal relies on close() for
HostLobbyModal, while preserving the existing confirmBeforeClose and
closeAndLeave behavior; use the openModal.close, openModal.leaveLobby,
openModal.closeAndLeave, and HostLobbyModal.onClose paths to locate the change.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 8c8b4bdf-67d1-47da-ae17-a4a0429e708e
📒 Files selected for processing (4)
src/client/HostLobbyModal.tssrc/client/Navigation.tssrc/client/components/BaseModal.tstests/client/LeaderboardModal.test.ts
Description:
old:

new:

Please complete the following:
Please put your Discord username so you can be contacted if a bug or regression is found:
w.o.n