Giter Club home page Giter Club logo

Comments (10)

iamdylancurran avatar iamdylancurran commented on June 20, 2024 3

Just want to follow up on this, from 3.9.4 to 3.9.5+ we are experiencing updates to the cache failing to apply and it's breaking many of our unit tests.

This only happens if we upgrade from 3.9.4 forward, and the issues seems to match the example you gave in the initial comment. There's no error or explanation given so we have no idea what we're actually meant to fix here, and we can't upgrade as it stands.

from apollo-client.

iamdylancurran avatar iamdylancurran commented on June 20, 2024 2

@jerelmiller Can confirm your fix solved our issue and we've updated to the latest release now, thank you 🙏

from apollo-client.

jonnyleeharris avatar jonnyleeharris commented on June 20, 2024 1

Just want to follow up on this, from 3.9.4 to 3.9.5+ we are experiencing updates to the cache failing to apply and it's breaking many of our unit tests.

This only happens if we upgrade from 3.9.4 forward, and the issues seems to match the example you gave in the initial comment. There's no error or explanation given so we have no idea what we're actually meant to fix here, and we can't upgrade as it stands.

I am having the exact same issue. Some e2e tests started failing - pinned it down to a cache update not occurring.

We do not use returnPartialData or notifyOnNetworkStatus.

We do make heavy use of fragments though, and are using @graphql-codegen to generate our type policies/fragment matchers.

I will report back if i find anything useful :)

from apollo-client.

av-k avatar av-k commented on June 20, 2024 1

Hi @jerelmiller, thank you for the update!

Firstly, I reverted to my source code at the point when I initially encountered the incorrect behavior with @apollo/client versions 3.9.5 and 3.10.3. I then took several steps within my app to ensure that the issue was reproducible with the current versions.

Next, I installed npm i @apollo/[email protected] and repeated the steps within my app to confirm whether the issue no more persisted with this specific version.

Following these steps, I can confirm that the issue has been resolved.

Is there anything else I can assist you with, @jerelmiller?
Once again, thank you for the fix!

from apollo-client.

jerelmiller avatar jerelmiller commented on June 20, 2024 1

Awesome to hear. Thanks @av-k! At this point I should just need a code review from the team to get it in. I'll try and get this in the next patch version. Thanks for confirming!

from apollo-client.

jerelmiller avatar jerelmiller commented on June 20, 2024

Thanks for letting us know @iamdylancurran! I can almost certainly guarantee its related to #11579. This fixed a bug where a partial cache update could be reported to a query that didn't accept partial updates, but seems it may have caused other side effects. No guarantees on a timeline, but we'll see if we can look at this soon.

from apollo-client.

jerelmiller avatar jerelmiller commented on June 20, 2024

Hey @av-k 👋

I've been digging into this a bit more to understand the change that happened. From what I'm seeing, it looks like 3.9.4 works because the partial cache write from one query/mutation causes a network request for the other query which will then fulfill the cache and re-render with the full data set. The change I introduced in 3.9.5 skips this step, so it explains why this broke for you. My learning here is that some partial cache writes are ok even if the query doesn't tolerate it since it will perform a network request to fulfill the whole result in that situation.

I think the proper thing for us to do instead would be to only avoid the partial cache broadcast on queries that had previously errored, but allow it on queries without errors to ensure that network request happens.

That said, would you be willing to provide me with a bit more "real world" reproduction of the bug? While the example you gave me properly demonstrates the issue, I'd argue that the reproduction is a misuse of the merge function since its returning a different data type than the schema allows. I know this was likely only for reproduction purposes, but I'd like to write a unit test for this in our codebase that better represents the actual scenerio that is causing the breakage.


@iamdylancurran and @jonnyleeharris does the above sound like the situation you're seeing as well? If either of you have a scenerio that I can use as a test case, that would also be awesome.

from apollo-client.

jerelmiller avatar jerelmiller commented on June 20, 2024

Scratch that, I think I was able to get a believable situation for my tests. I've opened #11839 which I believe addresses this issue.

@av-k @iamdylancurran @jonnyleeharris would you be able to try the following snapshot release to see if it addresses your issue?

npm i @apollo/[email protected]

@av-k I've tried that snapshot release on your reproduction and it seems to fix the issue: https://codesandbox.io/p/sandbox/issue-apollo-client-v-3-9-5-notes-app-forked-qcn3ct?file=%2Fpackage.json%3A10%2C25

from apollo-client.

github-actions avatar github-actions commented on June 20, 2024

Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo Client usage and allow us to serve you better.

from apollo-client.

jerelmiller avatar jerelmiller commented on June 20, 2024

Glad to hear it! Thanks for confirming.

from apollo-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.