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

Don't initialize $lazy meteor props #61

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

Don't initialize $lazy meteor props #61

wants to merge 1 commit into from

Conversation

red-meadow
Copy link

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

Fixes #49 (partially)
Fixes #52

For now, meteor properties marked as $lazy are not really lazy, because the functions are executed at least once in order to fill vm.$data.$meteor.data with initial values. It seems impossible to completely prevent execution without workarounds.

This PR proposes to get rid of values initialization at all. Defined meteor properties will be still proxied and therefore available in the component and template with undefined values. Running this.$startMeteor() will add actual values.

I understand that this change may easily breaks many existing apps based on the current $lazy behavior. A possible alternative is adding another special property to meteor object, like $noInit or something similar. Developer then can use both $lazy and $noInit or stay with the first one. Or, let's say, $veryLasy property which does the whole job. I can create a PR with this functionality.

@tennox
Copy link

tennox commented Apr 11, 2020

Caused by this fix for #34 and #38.

@red-meadow
Copy link
Author

red-meadow commented Apr 11, 2020

Thanks!
I saw that commit though I didn't pay attention to what issues it closed.
Have you tested the new code and encountered any issues with watchers or computed properties? Because for me everything works fine with both enabled and disabled $lazy.

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