Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How many subscriptions? #4

Closed
cgrand opened this issue May 7, 2019 · 3 comments
Closed

How many subscriptions? #4

cgrand opened this issue May 7, 2019 · 3 comments
Labels

Comments

@cgrand
Copy link
Owner

cgrand commented May 7, 2019

(todo list example)

If each component has its own query then for a todo-list of N items we get at least N+1 subscriptions (1 for the list and N for each item).

Having 2 queries sounds better; is it even doable to have only 1 query?

@cgrand
Copy link
Owner Author

cgrand commented May 7, 2019

Each template could be seen as a rule:
[(item [?id]) [?id :item/title]] (in practice it should be more filtered)
[(item-detail [[?id] ?title ?done]) [?id :item/title ?title] [?id :item/done ?title]]

Having a single query would mean having spare columns and reusing these spares across sibling templates (not sibling components: really sibling templates).

With two queries we would have [:find ?id :where (items ?id)] and [:find ?id ?title ?done :where (items ?id) (item-detail id ? title ?done)]

Derivation could leverage the nesting: derivation of the second query should not return retractions that are a consequence of the item being retracted, only retractions due to a change in title or status.

Thus when the row for a component is retracted we don't get retractions for its children which is not useful.

@cgrand
Copy link
Owner Author

cgrand commented May 7, 2019

Another point to keep in mind: multiple queries -> multiple subscriptions -> multiple handlers
As a consequence it may means transacting the state of the component hierarchy multiple times as a consequence of a single tx.

It's not good. We must have 1 tx -> 1 ui transact -> 1 render.

And/or we must be careful to not trigger on ui transacts.

@cgrand cgrand added the ponder label May 7, 2019
@cgrand cgrand mentioned this issue May 7, 2019
@cgrand
Copy link
Owner Author

cgrand commented May 10, 2019

It will be one query per template.

@cgrand cgrand closed this as completed May 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant