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

Need Help "Store reset while query was in flight (not completed in link chain" #12067

Open
wies105 opened this issue Sep 19, 2024 · 0 comments
Open

Comments

@wies105
Copy link

wies105 commented Sep 19, 2024

Hello,
I get Store reset while query was in flight (not completed in link chain) after cache.evict called.
I have an Angular 16 Project with "@apollo/client": "^3.11.0",

On Mutation, I will increase the cache.

    return this.apollo.mutate<T>({
      mutation: this.buildDeleteMutationRequest(mutationRequest, id),
      update: (cache, {data}) => this.deletedItemFromCache(cache, classRef, id)
    })
  private deletedItemFromCache<T>(cache: any, classRef: T, id?: number) {
    // Unique identifier for the request to be removed
    const singleRequest = getSingleRequestName(classRef);
    const listRequest = getListRequestName(classRef);
    cache.evict({ id: "ROOT_QUERY", fieldName: listRequest, broadcast: false });
     id && cache.evict({ id: "ROOT_QUERY", fieldName: singleRequest, value: id , broadcast: false });
     try {
      cache.gc({ resetResultCache: true });
     }catch (e : any) {
       console.error(e?.message ? e.message : e);
     }
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant