Quick Q: when updating a larger data source, will ...
# glance
a
Quick Q: when updating a larger data source, will it only update if the snapshotted state definition is not equivalent? I don't use state definitions because I'm trying to avoid doing a data duplication dance with react native If this is the case, is there a way to force an update? I'm thinking of just storing the last updated timestamp in millis to force this, hacky, but would probably work. I'd like to avoid this Edit: tried this, and realized it wouldn't work! The current composition doesn't get recreated (duh).
This is also how initial data is passed in
I might end up making a hacky datastore wrapper around room to fulfill the state definition part
Though, if there's an official or backdoor way to do this (not using data) store, that'd be amazing 🙏🏻
s
I might be misunderstanding, but you can just use a normal repository pattern and reference a state flow and it will update/recompose normally
a
True, but I'm inheriting code 😐
I will get to renaming it
That, and we cant really observe flows inside the widget
At least as far as I know
s
You can
a
Hmmmm, if that's the case, that definitely changes things
a
And will it update from a cold start?
s
So there's some caveats to it, you are still bound by the timeouts that the workers and receivers have to live by. For quick updates (like updating a message "I'm loading from disk" ->"I'm ready to work") it does will. I would think form a cold start your app would still need to kick off the updates
a
Gotcha, in my case, you interact inside the app, and the widget should update
I'll try this real quick
s
I think the flow only stays alive for about 10 seconds, but when you update the widget from the app the widget will start watching the flow until it gets timed out.
a
So it's working like magic 🙂
This is awesome 🤩
I would have thought any work done with a flow would be ignored once it is "dead"
So it seems to work half the time