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

apollograpqhl - readQuery from Store -> new references #3814

Closed
ghost23 opened this issue Aug 15, 2018 · 2 comments
Closed

apollograpqhl - readQuery from Store -> new references #3814

ghost23 opened this issue Aug 15, 2018 · 2 comments
Labels
🚧 in-triage Issue currently being triaged

Comments

@ghost23
Copy link

ghost23 commented Aug 15, 2018

Hello,

In this blog post:

https://blog.apollographql.com/apollo-client-0-8-e8db5efc75fb#889f

it says:

Since 0.7, Apollo Client returns referentially equal results when parts of a query result haven’t changed.

Is this still true for ApolloGraphQL, version 2.x ? Because for example, when I do a client.readQuery two times with the same query right one after another and then compare the results, they are not referentially equal.

Which makes implementing proper shouldComponentUpdate functions in React a bit tricky.

@CarloPalinckx
Copy link
Contributor

I set up a quick test that seems to point out that this is not the case:

https://github.com/CarloPalinckx/apollo-client/blob/readquery-referential/packages/apollo-cache-inmemory/src/__tests__/cache.ts#L204

which results in failure:

    expect(received).toBe(expected) // Object.is equality

    Expected: {"a": 1}
    Received: {"a": 1}

Not sure whether it should or shouldn't though. Maybe someone from the apollo team could chime in on this?

@hwillson hwillson added the 🚧 in-triage Issue currently being triaged label Jul 9, 2019
@hwillson
Copy link
Member

hwillson commented Jul 9, 2019

#4514 helps address this (and is available as of apollo-client 2.6.0). Thanks!

@hwillson hwillson closed this as completed Jul 9, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🚧 in-triage Issue currently being triaged
Projects
None yet
Development

No branches or pull requests

3 participants