Fix form sheet not closing after submit#192
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (9)
📝 WalkthroughWalkthroughThe PR changes showFormSheet so its onSubmit receives the sheet's BuildContext; submit handlers in seven screens were updated to use that sheetContext with mounted guards for post-await UI work, and tests were adjusted to exercise context lifetime and closing via sheetContext. ChangesForm Sheet Context Lifecycle
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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. Review rate limit: 6/8 reviews remaining, refill in 7 minutes and 32 seconds.Comment |
When an action sheet's row pops itself and immediately opens a form sheet (Edit Album/Artist/Playlist/Station, Add Podcast, Create Playlist/Folder), the form sheet's onSubmit closure captured the outer route's BuildContext. By the time onSubmit resumed after the network round-trip, that route was fully disposed, so Navigator.pop / showOverlay on it silently failed — the sheet stayed open with no feedback. showFormSheet now hands its own (always-mounted) context to onSubmit, and every caller uses that for pop and overlay. Adds a regression test that reproduces the action-sheet -> form-sheet flow.
a8408f0 to
807d02c
Compare
Summary
When a popup/action sheet's row pops itself and immediately opens a form sheet — e.g. Edit Album/Artist/Playlist/Radio Station, Add Podcast, Create Playlist / Folder — the form sheet's
onSubmitclosure captured the outer route'sBuildContext. By the timeonSubmitresumed after the network round-trip, that route was fully disposed.Navigator.pop/showOverlayon the dead context silently failed, so the form sheet stayed open with no feedback. The mutation itself succeeded server-side, but the UI never confirmed it.showFormSheetnow hands its own always-mounted context toonSubmit, and every caller uses that forNavigator.popandshowOverlay. Each caller also gates withsheetContext.mountedafter the await as a belt-and-braces.Adds a regression test in
form_sheet_test.dartthat reproduces the action-sheet -> form-sheet flow: opens an inner route, has it pop itself and open the form sheet, awaits a delay inonSubmit, then asserts the form sheet closes after Save.Test plan
flutter test— all 288 tests pass, including the two newonSubmit context lifetimetests.Summary by CodeRabbit
Bug Fixes
Tests