Skip to content

Conversation

@davidmartos96
Copy link

Fixes #390

result.recompute(); in the addPostFrameCallback might get called with an invalid widget context on hot reload. I don't think this block is really needed, because didUpdateWidget is already taking into consideration the builder changing to properly update the "cached" widget signal.

I've tried and it seems to be working ok. Alternatively, if we want to keep the callback, we can add if (!mounted) return at the very beginning. This is the first thing I changed, but then I noticed that on hot reloads, the computed widget signal was being recomputed twice (one the callback and the other the didUpdateWidget), that's why I opted to kee the didUpdateWidget recompute only.

Also, I believe the didUpdateWidget needs to be a separate if statement, not if-else. Otherwise, we don't recompute if the dependencies list changes and the builder also changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant