meteorrn / meteor-react-native

Meteor client for React Native matching Meteor Spec
https://guide.meteor.com/react-native.html
Other
59 stars 31 forks source link

Add skipUpdate function to useTracker #103

Closed bratelefant closed 1 year ago

bratelefant commented 1 year ago

I'm trying to gain more control of forced rerenders coming from useTracker on when connection status changes. E.g. on my main view I subscribe to an unread messages pub, and every connection state change causes the whole TabNav UI to render.

I suppose that preventing updates via a value check in a skipUpdate-function as an additional parameter to useTracker just like in the meteor react tracker could give more control on unwanted rerenders.

Maybe I could accomplish the same by moving the trackers deeper in the component tree, or check the the connection status changes. But even then, the tracker computations need a rerun as during the offline state data might have changed. If not, an update could be skipped.

I'm trying to implement a true offline first approach in my app, where data is 100% visible all the time, even if it's stale or loading. E.g. a list of messages should always be visible, loading state is indicated by an activity indicator added on top of the FlatList, rather than showing a full screen activity indicator.

TheRealNate commented 1 year ago

Hey @bratelefant, have you looked at the local package?

bratelefant commented 1 year ago

Played around with it a little bit, but it didn't quite fit; can't remember why I moved way from it actually.

github-actions[bot] commented 1 year ago

Closing this issue due to no activity. Feel free to reopen.