Skip to content

Commit

Permalink
wip action_sheet: Fix use of stale context; TODO is this real?
Browse files Browse the repository at this point in the history
On hot reload, the `DesignVariables.of(context)` lookup in this
builder could throw because `context` was no longer mounted.
(I'm not sure if the issue could also be triggered in release builds.)

... Well, in any case this came up when doing hot reload while in
the emoji picker, from 1103.  But then even after this change,
a very similar symptom continued, just not at this line.
I also don't have a great theory for how it was happening
in the first place.

The symptom didn't seem to always happen.  I think it may have been
connected to when the per-account store got replaced -- as a
consequence not actually of the hot reload, but of coming back online
after having the device asleep for a while as I edited the code.
If that is the trigger, then it may affect real users.
OTOH I still don't have a great theory for how it would cause
the context to no longer be mounted -- the whole point of
PerAccountStoreAwareStateMixin is that all the elements and state
get to stay in place while the PerAccountStore itself is replaced.
  • Loading branch information
gnprice committed Dec 8, 2024
1 parent f7421bf commit a01fabf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/widgets/action_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void showMessageActionSheet({required BuildContext context, required Message mes
clipBehavior: Clip.antiAlias,
useSafeArea: true,
isScrollControlled: true,
builder: (BuildContext _) {
builder: (BuildContext context) {
return SafeArea(
minimum: const EdgeInsets.only(bottom: 16),
child: Padding(
Expand Down

0 comments on commit a01fabf

Please sign in to comment.