vue-meteor-tracker
vue-meteor-tracker copied to clipboard
What's the downside of Vue.config.meteor.freeze = true?
I tried setting it to true, and everything still updates as it should. But since it's not the default, I assume it must cause problems in some cases?
The data returned is immutable and you have to clone it to modify it.
Ah, but when would you want to modify something returned by Meteor? Wouldn't that be bad practice anyway? Since it would just get overridden when Meteor updates again. I'll keep it set to true then.
Yes, that is what I would do.
But is this checked anywhere by Vue?
It gets checked by vue-meteor-tracker: https://github.com/meteor-vue/vue-meteor-tracker#freezing-data
No, I found it. There is a check Object.isExtensible() in Vue code. I was searching for Vue.isFrozen.
Ah, I thought you meant the Vue.config.meteor.freeze option 😛
Is it possible to only freeze for example one meteor subscription? Or perhaps only set
Vue.config.meteor.freeze = true; for one Vue component and not assign it globally?
You can freeze the data yourself in the update function.