Comments (11)
you can try this:
client.cache.reset()
from apollo.
For others with multiple clients, you can run this from inside a component:
Object.values(this.$apollo.provider.clients)
.forEach(client => client.cache.reset())
from apollo.
related to apollographql/apollo-client#1509
from apollo.
I got the same problem.
from apollo.
Looks like react-apollo had the same issue, until this PR apollographql/react-apollo#531
There was this PR apollographql/apollo-client#1636 that introduced a new fetch policy "standby" for this kind of use case
from apollo.
@Akryum it would be very useful for others if you can add it to docs. Thanks @Risbot
from apollo.
@Risbot sharing your solution across related issues. thanks!
from apollo.
does cache.reset()
clear the store data?
I rely on query result to show the profile data
apollo: {
profile: GetProfile
}
<div v-if="profile">
// user data
</div>
When I call cache.reset()
on logout the cache is cleared (i can see by inspecting $apollo object) but the store profile field/data is still populated and the div with the profile data does not disappear.
On logout I would like to clear cache and store data (without re-running queries) and get the view updated as it happen after a mutation for example.
What is the proper way to do it? Thanks in advance
from apollo.
Just found my way here & want to make sure you got your answer, @b4dnewz. You still need help with clearing your store?
from apollo.
@bswank actually with the latest version it does not happen, or at least I've not experienced it anymore
but if you want to share your thoughts and a clarification about the arguments it's well accepted 👍
from apollo.
@Akryum This ticket shouldn't be closed. Smart queries still ignore the skip function/flag when data is refetched
from apollo.
Related Issues (20)
- Remove automatic subscription retry on error
- Can't receive messages in a chat using subscription
- skip() doesn't skip query HOT 1
- @vue/apollo-ssr doesn't work in SSR mode
- Fragments aren't returned in results when using useQuery/useLazyQuery reactive refs HOT 2
- Using vue-apollo-composable inside a Pinia setup store HOT 2
- `useApolloClient` checks wrong conditions before calling `inject()`
- useQuery blocks page load on 4.0.0 HOT 2
- useQuery with fetchPolicy: cache-only does not return expected data HOT 3
- Doesn't update the data after a mutation if `enabled` is `false` in `useQuery`
- Queries are not executed in given order
- @vue/[email protected] has a peer dependency conflict with Vue 3 HOT 4
- [docs] The installation guide is very bad HOT 1
- Refetch with New Variables Overrides Other Existing Refetches HOT 1
- `onBeforeUnmount` hook in `useQuery` is undesirable when used in pinia store HOT 1
- [Documentation] Composition API + Options API Configuration, how to make it work together? HOT 2
- Updating the `variables` ref does not work when using the function form
- Production breaks, dev mode works (Apollo client with id default not found.) HOT 3
- onResult does not fire on the first load of useLazyQuery HOT 5
- @vue/apollo-option - memory leak on SSR render
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from apollo.