Skip to content

Transitioning the Indexer from the static tree to the runtime tree

António Nuno Monteiro edited this page Feb 19, 2016 · 11 revisions

Transitioning the Indexer from the static tree to the runtime tree

Currently, getting the root query of an Om Next app will not return an updated view on the app's query structure if some child instance of the root has changed its query. Transitioning the indexer to the runtime tree would allow a consistent view of the UI tree with respect to query structure. In order to achieve that, a few constraints need to be introduced in the way we allow components to change their queries at runtime.

Possible solutions

Restrict set-query!'s behavior

  1. Restricting set-query! such that:
  • we only allow an instance to set its query if it satisfies at least one of the following:
    1. the instance has a ref, independently of how many instances of such class exist
    • we can get this new query via subquery later
    1. there's only one instance of this class in its data-path
    • this is possibly preferred over class-path since it builds directly on the structure of the queries in the app
    1. if none of the above apply, we change the query for the class
    • this allows dynamism in setting the query for all the instances of a certain class in a join
    • comparable to setting the query of all posts in a Dashboard similar to the "Queries with Unions" tutorial
  1. get-query would need to be modified for component instances in order to make it work with the new semantics of set-query!

  2. build-index would most probably be fixed for free because it just uses get-query on the root and goes from there.

  3. full-query would also be fixed for free because it leverages the indexes which we fixed in 3).