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

Fix double execution of meteor properties functions #60

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Fix double execution of meteor properties functions #60

wants to merge 1 commit into from

Conversation

red-meadow
Copy link

@red-meadow red-meadow commented Nov 1, 2019

Fixes #49 (partially)

As described in the issue, meteor properties functions (without $lazy) are executed twice during component creation. The reason for this behavior is that a function is first executed by vm.$watch() to initialize Vue Watcher and then executed by Tracker.autorun() in order to initialize Computation.

Proposed changes:

  • move watcher initialization inside Tracker.autorun() callback with computation.firstRun condition.

I don't really like this solution but it seems to be working without side effects. The drawback is an additional condition checking on each autorun execution.

@Akryum, I found several of your comments about separating the Tracker and Vue callbacks but I am not sure whether they are related to this PR or you meant a deeper integration. I must admit that my understanding of Watcher and Tracker insides is not enough to conclude whether proposed changes are safe, so I will be grateful for the PR review and possible comments.

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

Successfully merging this pull request may close these issues.

Meteor properties over reactive?
1 participant