Files
buzz/mobile/test
Tom Brow 5f80ee1968 fix(mobile): keep Move to section working after the actions sheet closes (#9814)
Move to section has been failing on mobile: choosing a section, creating
a new one, or removing the channel from its section throws a
`StateError` ("Using ref when a widget is about to or has been
unmounted") and the channel stays where it was.

- **Disposed ref.** The section picker opens from the channel actions
sheet, which closes first. The picker read and wrote sections through
that sheet's `WidgetRef`, which is disposed by the time the user taps a
row. It now uses the page's `ProviderContainer`, which it already used
to listen for desktop's layout lock. Channel details passed its own
`ref` the same way and now goes through the same path.
- **New section never filed the channel.** It created the section, then
looked it up by name in the provider's state, which local edits only
reached after a relay round trip. The notifier now creates the section
and files the channel in one call, by the new section's ID, so a second
section with the same name can't catch it either.
- **Local edits show at once.** `createSection`, `assignChannel` and
`unassignChannel` now emit the notifier's state right away, as
`deleteSection` already did, so a picked or removed channel moves in the
sidebar immediately instead of after the relay echoes the edit.
- The New section dialog disposed its text controller while still
animating out; the dialog now owns its controller.

### Validation

- [Move to section
journey](0147d7a0f2/mobile/test/features/channels/channel_actions_sheet_test.dart):
opens the picker from the actions sheet with the real sections notifier
(storage and relay faked) and checks the shown and saved section after
picking a section, Remove from section, and New section, including when
a section with the new name already exists.
- Automated iOS simulator run (iPhone 17 Pro, signed-in Builderlab
account): long-press a channel, Move to section, then New section (with
a name that already existed), pick an existing section, and Remove from
section. Each move showed in the sidebar immediately and no errors were
logged. The recording shows real channel names, so it is shared
internally rather than here.

### Regressions

None expected. The picker reads the same provider from the same root
scope (mobile has a single `ProviderScope`), through a handle that
outlives the closed sheet. Emitting after local edits rebuilds section
listeners once per edit, which Delete section already did.

---------

Signed-off-by: Tom Brow <tomb@block.xyz>
Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@localhost>
2026-11-20 14:51:22 -08:00
..