Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add function to expose tracker inFlush variable #8565

Merged
merged 1 commit into from Apr 5, 2017

Conversation

@maxnowack
Copy link
Contributor

@maxnowack maxnowack commented Apr 5, 2017

inFlush indicates wether a flush is active or not. Slightly the same like Tracker.active with one big difference. Tracker.active gets unset inside Tracker.nonreactive.
I want to savely call Tracker.flush() without getting the Can't call Tracker.flush while flushing error.
Tracker.active doesn't work for me, since I don't know if the flush was called inside Tracker.nonreactive. I think I need to access the inFlush variable to get the global flushing state.

Background:
I'm writing a package to connect reactive data to react components. In direct comparison with react-meteor-data, I want to reduce the reruns of the reactive function if the props of the component change. To avoid unnecessary renders, I'm calling Tracker.flush() inside of componentWillReceiveProps to run the reactive function and set the new state.

benjamn
benjamn approved these changes Apr 5, 2017
@benjamn benjamn merged commit 759671d into meteor:devel Apr 5, 2017
3 checks passed
@benjamn
Copy link
Member

@benjamn benjamn commented Apr 5, 2017

Thanks @maxnowack, and good luck with your reactive React package.

@maxnowack maxnowack deleted the expose-tracker-inflush branch Apr 5, 2017
@abernix
Copy link
Member

@abernix abernix commented Apr 27, 2017

This should be available to test in the release candidate for Meteor 1.4.4.2, currently 1.4.4.2-rc.1:

meteor update --release 1.4.4.2-rc.1

Please report any problems you encounter!

@avalanche1
Copy link

@avalanche1 avalanche1 commented May 22, 2017

No mention in http://docs.meteor.com/api/tracker.html about it...

@maxnowack
Copy link
Contributor Author

@maxnowack maxnowack commented May 23, 2017

@avalanche1 you're right. I've created a PR: meteor/docs#135

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants