Skip to content

reactive queries and field edges #72

@tantaman

Description

@tantaman

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).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions