Files
buzz/mobile/lib/shared
Tom Brow 6dbd159676 fix(mobile): keep "+" reactions working when a new message rebuilds the row (#9831)
## Summary

A new message shifts the timeline and can unmount the long-pressed
message row while its actions sheet or emoji picker is open. Then:

- tapping "+" in the actions sheet did nothing, because the picker
opened from the row's dead context (after [#9820 emoji picker
crash](https://github.com/block/buzz/pull/9820), it is a silent no-op
instead of a crash), and
- a pick made after the row went away read through the row's disposed
`WidgetRef`, so the reaction was dropped.

The actions sheet and the timeline "+" pill now capture the page's
`ProviderContainer` and its navigator's context when they open. The
picker opens from the navigator, and reaction dispatch reads through the
container. `toggleReaction` and `armReactionBurst` take a container, and
grouped system rows read through one too. The reactions tray's Add
button keeps working after the row is gone, since its callback holds the
container and navigator it captured at build time.

Reactions are also bound to the community that was active when the
surface opened: the actions sheet and the reaction details tray (Flutter
sheet or native iOS tray) capture it when they open, and the timeline
"+" pill when it is tapped. If a notification switches community
meanwhile, a quick tile, picker pick, tray toggle or tray Add is dropped
instead of being recorded, animated or published as the newly active
account. `ChannelActions.isCommunityValid` now uses the same
`RelayConfig.isSameCommunity` comparison.

Failure notices for these reactions show from the captured navigator's
context, so they still appear when the row is gone.

## Regressions

None expected. The picker attaches to the same navigator as before (the
row's nearest navigator), and the providers read are the same ones, from
the same `ProviderScope`.

## Validation

- New regression tests in `message_actions_row_rebuild_tests.dart`: the
row unmounts before "+" is tapped, and while the native picker is open.
Both failed on main (picker never presented, pick lost) and pass with
the fix. Two more switch community while the sheet is open, then tap a
quick tile or pick from "+", and check nothing is added, recorded or
armed.
- New test in the reaction row combined tests: the row unmounts while
the native reactions tray is open, and its Add still opens the picker.
Another switches community while the tray is open and checks that a tray
toggle and Add are both dropped.
- Automated simulator app test (iOS 27 sim): opened a channel,
long-pressed a message, tapped "+", picked an emoji in the native
picker, and saw the reaction land. Then toggled it off from the
reactions sheet. Live edits and reactions from another client arrived
during the run without issue.

---------

Signed-off-by: Tom Brow <tomb@block.xyz>
Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@buzz.block.builderlab.xyz>
2026-11-23 08:43:29 -07:00
..