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

Identifying cache records using graphql aliases #12075

Open
solomspd opened this issue Sep 25, 2024 · 1 comment
Open

Identifying cache records using graphql aliases #12075

solomspd opened this issue Sep 25, 2024 · 1 comment
Labels
🏓 awaiting-team-response requires input from the apollo team

Comments

@solomspd
Copy link

A query alias, although is present in the query does not appear in the cache explorer. How is it possible to use an alias for identifying a cache record?

To take the aliasing example in the documentation

query AdminsAndManagers {
  admins: users(role: "admin") {
    id
    firstname
    lastname
  }
  managers: users(role: "manager") {
    id
    firstname
    lastname
  }
}

How is possible to use cache.identify to distinguish between the two users object if aliasing is not coupled with it in the cache?

How else is possible to, for example, mutate the admins using a cache.modify statement in an update statement?

@bignimbus bignimbus added the 🏓 awaiting-team-response requires input from the apollo team label Oct 7, 2024
@dylanwulf
Copy link
Contributor

I'm assuming users will return a list of objects? Typically you would use readQuery & writeQuery or updateQuery to update data like this. cache.modify might not be the best fit here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏓 awaiting-team-response requires input from the apollo team
Projects
None yet
Development

No branches or pull requests

3 participants