fix: guard empty documents list before accessing .first (fixes #778)#779
fix: guard empty documents list before accessing .first (fixes #778)#779dolliecoder wants to merge 2 commits intoAOSSIE-Org:masterfrom
Conversation
|
🎉 Welcome @dolliecoder!
We appreciate your contribution! 🚀 |
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@lib/controllers/upcomming_rooms_controller.dart`:
- Around line 113-124: The unsubscribe query uses the wrong field name
("userId") causing no matches; change the Query.equal call in the unsubscribe
logic to use "userID" (the same field used elsewhere when writing/reading
subscriptions) so the query that builds response (the block that constructs
Query.equal('userId', authStateController.uid), Query.equal('upcomingRoomId',
upcomingRoomId)) becomes Query.equal('userID', authStateController.uid),
ensuring the response.documents lookup and subsequent subscribeDocument handling
find the correct document.
Description
Fixes #778
Adds a defensive guard in
removeUserFromSubscriberListto prevent aStateErrorwhen accessingresponse.documents.firstif the list is empty.Previously, calling
.firston an empty list could cause a runtime crash.The method now safely returns early when no matching subscription document exists.
Type of change
Checklist: