vue-meteor-tracker icon indicating copy to clipboard operation
vue-meteor-tracker copied to clipboard

Don't initialize $lazy meteor props

Open red-meadow opened this issue 6 years ago • 2 comments
trafficstars

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.

red-meadow avatar Nov 01 '19 23:11 red-meadow

Caused by this fix for #34 and #38.

tennox avatar Apr 11 '20 21:04 tennox

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.

red-meadow avatar Apr 11 '20 22:04 red-meadow