Hi folks. Is there any recommended way to change m...
# compose
s
Hi folks. Is there any recommended way to change multiple mutableState variables in one transaction? the second variable i change doesn't seem to cause a re-render
👀 1
f
way to change multiple mutableState variables in one transaction
This should work:
Copy code
Snapshot.withMutableSnapshot {  }
But that the second variable not causing re-rendering might be a different problem 🤔
☝🏻 1
v
if you're running on the main thread you shouldn't need to use withMutableSnapshot
👆 1
👆🏻 1
👆🏾 1
z
Yep if you’re changing it on the main thread and something isn’t invalidating like you expect, using an explicit snapshot probably won’t help since the two states are probably read in separate invalidation scopes, which will still invalidate independently regardless of which snapshot application does so.
s
Turns out it was a silly coding error on my part 🤦 wasn't reading my own code carefully enough - i was never passing the altered variable into the component. Now all works as expected. Thanks anyway
👍🏻 1
👍🏼 1
👍🏾 1