You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm encountering a challenge with refetching data in a Vue.js application using Vue Apollo, particularly after changing the context. Our application's context changes dynamically, making it essential to fetch the most up-to-date data from the server. This is crucial since the entities in our application are shared with mutations across these various contexts.
GraphQL query:
query BookList($libraryContext: LibraryContextFilter, $filter: ListFilter) {
books(libraryContext: $libraryContext, filter: $filter) {
page
limit
total
items {
id
title
genre
author {
name
}
}
}
}
The issue arises when refetching data after a context change. I noticed that using a refetch with the fetchPolicy: "network-only" seems to inadvertently alter the default fetch policy for other queries and refetch operations within the application. As a solution, I've reverted the fetch policy to cache-first for other refetch operations.
My question is: Is this overriding behavior of the refetch is an expected behavior or a bug? Is there a more appropriate method to ensure fresh data retrieval from the server without impacting the global fetch policy settings?
I'm encountering a challenge with refetching data in a Vue.js application using Vue Apollo, particularly after changing the context. Our application's context changes dynamically, making it essential to fetch the most up-to-date data from the server. This is crucial since the entities in our application are shared with mutations across these various contexts.
GraphQL query:
In the BookStore:
In the component Book.vue:
The issue arises when refetching data after a context change. I noticed that using a refetch with the fetchPolicy: "network-only" seems to inadvertently alter the default fetch policy for other queries and refetch operations within the application. As a solution, I've reverted the fetch policy to cache-first for other refetch operations.
My question is: Is this overriding behavior of the refetch is an expected behavior or a bug? Is there a more appropriate method to ensure fresh data retrieval from the server without impacting the global fetch policy settings?
Versions
"vue": "^3.4.15",
@vue/apollo-composable: "^4.0.1",
"@apollo/client": "^3.8.10",
The text was updated successfully, but these errors were encountered: