julienvincent / modelizr

Generate GraphQL queries from models that can be mocked and normalized.
http://julienvincent.github.io/modelizr
176 stars 6 forks source link

Multiple root models of the same type in a query generate conflicting entity ids #5

Closed julienvincent closed 8 years ago

julienvincent commented 8 years ago

Using multiple root models of the same type in a query, like this:

query(
    book(),
    book()
)

or

query(
    user(
        book()
    ),

    book(
        user().as("author")
    )
)

Will cause entities with conflicting ids to be generated. This is as the mocking cache is not scoped at a query level, but at a root model level.

The cache needs to be scoped to the query.