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

useFragment doesn't respect the @nonreactive directive #11785

Closed
broyde opened this issue Apr 15, 2024 · 3 comments · Fixed by #11844
Closed

useFragment doesn't respect the @nonreactive directive #11785

broyde opened this issue Apr 15, 2024 · 3 comments · Fixed by #11844
Assignees
Labels

Comments

@broyde
Copy link

broyde commented Apr 15, 2024

Issue Description

  1. Create a fragment with @nonreactive field, write some data into the cache.
  2. Use this fragment in useFragment.
  3. Update the value of @nonreactive field.

Expected behavior: useFragment does not react to such changes.
Actual behavior: useFragment triggers update in the same way as it does without @nonreactive directive.
Test example: https://github.com/broyde/apollo-use-fragment-nonreactive/blob/main/test.js

FYI: I've noticed the same behavior of useQuery, but only in test environment (see test: https://github.com/broyde/apollo-query-nonreactive/blob/main/test.js). In real browser useQuery does not react to such changes, but useFragment does.

Link to Reproduction

https://github.com/broyde/apollo-use-fragment-nonreactive

Reproduction Steps

No response

@apollo/client version

3.9.11

@jerelmiller jerelmiller added the 🏓 awaiting-team-response requires input from the apollo team label Apr 15, 2024
@jerelmiller
Copy link
Member

Hey @broyde 👋

Thanks for the report! Initially the @nonreactive directive was meant for use with queries, not fragments, but we talked about this more as a team and think this change makes sense. We re-read through our docs and realized that its a bit ambiguous on the original intention so we plan to make a temporary docs update until we can get this functionality in place.

We are releasing 3.10 this week and will try and target this change for one of the 3.10.x patch releases.

Copy link
Contributor

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.

Copy link
Contributor

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.
For general questions, we recommend using StackOverflow or our discord server.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants