This repository was archived by the owner on Oct 1, 2022. It is now read-only.

Description
This is a weird issue to replicate, the quick fix is to use $collections.filters.thing instead of $collections.thing.
The collection class prepares the namespace (for data, groups, actions and filters) before init, as to prevent this from happening, but thing is undefined when Vue creates the components, even though devtools shows it as defined before Vue initiates.
thing should be accessible from both the $collection object, and the $collection.filters object. This function takes care of ensuring it is defined before runtime.
// reserves the namespace on the component instance before runtime
prepareNamespace() {
// settings here..
Object.keys(this._public).forEach(category => {
if (['data', 'actions', 'groups', 'filters'].includes(category)) {
Object.keys(this._public[category]).forEach(item => {
if (this.validateNamespace(this._public, item))
this._public[item] = this._public[category][item];
});
}
});
}
This feels like it'll take some digging, here are some facts that puzzle me.
- Every collection is init before Vue starts,
Pulse.js constructor loops this.initCollections() which has prepareNamespace().
$collection.filters.thing works but $collection.thing doesn't, but prepareNamespace() should solve this
- After at least one re-render it works fine, so usually it errors in the console as undefined then a second later the data populates.