meteor-react-native
meteor-react-native copied to clipboard
useTracker function gets called again at each re-render even while setting deps as []
Describe the bug
const myValue = Meteor.useTracker(() => {
console.log("Called");
return false
}, []);
I am getting "Called" multiple times in the console at every re-render
Expected behavior To be called only once
I believe my branch fixes this issue if you want to give it a try I did a pretty big restructuring of this package: https://github.com/ToyboxZach/meteor-react-native
I already commented on the PR #94 There is definitely an issue with useTracker, and @ToyboxZach 's fork solves it.
I subscribe in useTracker to a pub from meteor server, and this gets called ~15 times server side (logged every sub) for one ui view, although dep list is emtpy; this results in heavy server load and really slow response times (up to 6-7 seconds).
@bratelefant We are discussing merging #94. In the meantime, if you can cherry pick the changes from #94 that solve your problem and open a new smaller PR, happy to merge them in
I really can't promise that I'm capable to get this done, but I can try to filter out the changes that solve my issue. Will post my results in #94.
Closing this issue due to no activity. Feel free to reopen.
This should likely be fixed in #111 please reopen if the issue persists