-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
After createOneDbConnection mutation, update cache manually instead of using refetchQuery #5684
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
- Removed
refetchQueries
inuseCreateOneDatabaseConnection.ts
- Manually updated Apollo cache after mutation
- Ensured cache reliability post-redirection
- Improved handling of newly created remote server data
}, | ||
}; | ||
|
||
if (isDefined(cache.readQuery(getManyDatabaseConnectionsQuery))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure cache.readQuery
returns a defined result before updating the cache.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔥
…f using refetchQuery (#5684) Closes #5057. RefetchQuery is unreliable - [it won't be executed if the component is unmounted](apollographql/apollo-client#5419), which is the case here because of the redirection that occurs after the mutation. We want to avoid using refetchQuery as much as possible, and write directly in the cache instead.
…f using refetchQuery (twentyhq#5684) Closes twentyhq#5057. RefetchQuery is unreliable - [it won't be executed if the component is unmounted](apollographql/apollo-client#5419), which is the case here because of the redirection that occurs after the mutation. We want to avoid using refetchQuery as much as possible, and write directly in the cache instead.
Closes #5057.
RefetchQuery is unreliable - it won't be executed if the component is unmounted, which is the case here because of the redirection that occurs after the mutation.
We want to avoid using refetchQuery as much as possible, and write directly in the cache instead.