-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
useFragment
does not re-render as expected in v3.11.5
#12048
Comments
Thank you for the bug report and the test! There should be a PR release with a potential fix available in a few minutes over in #12049 in a few minutes - could you please give that a try and report back? :) |
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. |
And shipped :) |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Issue Description
This appears to be a regression in
v3.11.5
as I can't reproduce this issue onv3.11.4
. I suspect the issue could be with #12020 since it's mentioned in the changelog and seems directly related to this hook, but I haven't done much investigation to confirm.The gist of the issue is that
useFragment
isn't re-rendering as expected when data is written to the cache that (1) is a change from the currently cached data and (2) matches a value that was previously cached for that data. I've updated one of the existing unit tests in the suite to demonstrate the issue more clearly.As a practical example, this means that using
useFragment
to monitor data that is updated by a mutation tied to a simple on/off toggle is dropping re-renders when returning to its initial state after updating to v3.11.5.Link to Reproduction
Branch: https://github.com/maciesielka/apollo-client/tree/bug/maciesielka/use-fragment-does-not-rerender
Compare: main...maciesielka:apollo-client:bug/maciesielka/use-fragment-does-not-rerender
Reproduction Steps
See updated test in the branch linked above, or re-created below as a diff.
The test adds the following steps:
These assertions fail in
v3.11.5
(on which the provided branch is based), but the same test applied tov3.11.4
passes.Git diff
@apollo/client
version3.11.5
The text was updated successfully, but these errors were encountered: