webix-meteor-data
webix-meteor-data copied to clipboard
observables are never stopped
Hi Maksim
I'm using your meteor data proxy, but it seems the query handle created by cursor.observe is not stopped when you call load on the same object again (e.g. to load other data in the component). From the meteor docs: "observe returns a live query handle, which is an object with a stop method. Call stop with no arguments to stop calling the callback functions and tear down the query. The query will run forever until you call this." As a result, when the original data changes, the observable still tries to update the view, but its data has changed, resulting in an error.
I believe this could be resolved by storing the returned object from this.cusor.observe in this.query and before creating a new query calling this.query.stop() if this.query is already set.
I'm not sure destroying the webix object cleans this up either, it might result in memory problems.
Storing it in the proxy is not enough, because a new proxy is created every time. Storing it in the view itself does the trick.
Yep, I see the issue It will be fixed in oncoming Webix 2.3. View object will destroy the proxy when it is reloaded with new data or when view itself is destroyed.
Also, if you need to load data only, without full sync then you can use autorun instead of a proxy. It will stop observing after template destroying automatically.
https://github.com/dandv/meteor-webix/issues/5#issuecomment-75568664
It will be fixed in oncoming Webix 2.3
@mkozhukh, any updates now that Webix 2.3.8 is out? Also, this line mentions a Webix 2.2 limitation.