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

reactive queries and field edges #72

Open
tantaman opened this issue Sep 27, 2022 · 0 comments
Open

reactive queries and field edges #72

tantaman opened this issue Sep 27, 2022 · 0 comments
Labels
bug Something isn't working priority:high query-layer

Comments

@tantaman
Copy link
Collaborator

When traversing from a root node through a field edge, updates to the field edge do not correctly update the reactive query.

foo.queryBar().genLive()
foo.update({
  barId: newId
});

new bars won't be received as barId is encoded by value in the query.

Few options:

  1. live queries rely on a "query provider" function that is re-run to regenerate the query and re-capture variables
    This means the live query api must change quite a bit. To something like:
    makeLive(() => foo.queryBar());
  2. queryBar dynamically binds the barId in the query... So when it is re-run it is reading the latest barId from foo. This works but vastly changes the semantics of queries and maybe makes the unpredictable? If anyone ever saves a query then its results could change depending on when it is invoked... Queries are thus no longer immutable either. A query's behavior could change due to random other pieces of code mucking with unrelated objects.

Option (1) sounds like the right path. Too much spooky action at a distance in option (2).

@tantaman tantaman added query-layer priority:high bug Something isn't working labels Sep 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority:high query-layer
Projects
None yet
Development

No branches or pull requests

1 participant