ibm-js / delite

HTML Custom Element / Widget infrastructure
http://ibm-js.github.io/delite/
Other
68 stars 28 forks source link

Store: delay query until after subclass sets this.query #442

Closed wkeese closed 8 years ago

wkeese commented 8 years ago

Assuming this.source is set on widget creation, delite/Store will fire the query against the store in Store#computeProperties(), before the subclass's computeProperties() method runs. Thus, if the subclass sets this.query in its computeProperties() method, it will trigger another store query. This is inefficient, especially if the query runs against the server.

Instead, delite/Store should delay running the query until after the subclass's computeProperties() method has run. Presumably by using after advice.

This problem could also be solved by using dcl.superCall() in all of the subclasses, but modifying delite/Store.js seems cleaner.