kamilkisiela / apollo-angular

A fully-featured, production ready caching GraphQL client for Angular and every GraphQL server 🎁
https://apollo-angular.com
MIT License
1.5k stars 309 forks source link

PersitedQueryLink: AssetNotDestroyed Error when running ssr #2017

Closed luca-peruzzo closed 1 week ago

luca-peruzzo commented 1 year ago

Describe the bug

I don't know why yet, but using createPersistedQueryLink function to create ApolloLink in ssr causes this runtime error

To Reproduce

import { sha256 } from 'crypto-hash';

...
const persist = createPersistedQueryLink({
        sha256,
        useGETForHashedQueries: false,
      });
const http = httpLink.create({
        uri: environment.graphqlEndpoint,
        withCredentials: true,
        useMultipart: false,
        useGETForQueries: false,
      });

const link = persist.concat(http)

Expected behavior

Work in ssr mode

Environment:

├─ @angular/cli@16.0.2
├─ @angular/core@16.0.2
├─ @apollo/client@3.7.14
├─ apollo-angular@5.0.0
├─ graphql@16.6.0
└─ typescript@4.9.5
PowerKiKi commented 1 week ago

Please provide a Minimal, Complete, and Verifiable example of code that exhibits this issue.