-
-
Notifications
You must be signed in to change notification settings - Fork 115
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
Stop establishing unnecessary reactive dependencies #406
Stop establishing unnecessary reactive dependencies #406
Conversation
@imajus thank you for this PR! Would you mind checking the tests? There seem to be at least one failed test, indicating that this may be a breaking change. |
@jankapunkt thanks for a guidance. There was, in fact, an error in my initial implementation, which is now fixed. Hail to the automated testing! |
Generally approved from my end. @StorytellerCZ do you have something to add? If not we can merge this. @imajus is there a way to test this from a UnitTest perspective? I've looked into the the example and I would like to avoid detecting, whether we are in a loop (if it fails it would consume all our free CI time). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@jankapunkt Thanks for approving the PR. What I have introduced there is more like an integration test, but it is designed the way that it won't cause an infinite loop in case of a failure. I think that it is the most practical way of testing this issue. If you'd like I could also cover |
@StorytellerCZ should we target 2.6.2 or 3.0.0 with this? |
Let's do 2.6.2 and release it with the changes earlier. |
The problem I have faced in my current Meteor project is clearly demonstrated in this simple example project: https://github.com/imajus/blaze-reactive-loop-example
While this doesn't cause visible issues in most cases, in some cases, like the one presented in this repository, it can lead to unexpected and hard-to-track issues. Additionally, it adds unnecessary overhead to the reactive computation system, which may result in unnecessary re-rendering.
Proposed solution
Since the behavior in question is definitely not intended and potentially harmful, I believe the best approach would be to prevent event handlers from establishing new reactive dependencies if they are called from any reactive computation.