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

Open
broyde opened this issue Apr 15, 2024 · 1 comment
Open

useFragment doesn't respect the @nonreactive directive #11785

broyde opened this issue Apr 15, 2024 · 1 comment
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.

@jerelmiller jerelmiller added 🐞 bug and removed 🏓 awaiting-team-response requires input from the apollo team labels Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants