newbeea / nuxt3-apollo-module

33 stars 8 forks source link

Doesnt properly work with ssr: false; nuxt3 #6

Open steinathan opened 2 years ago

steinathan commented 2 years ago

Disabling ssr (ssr: false) produces this error

Unexpected token u in JSON at position 0

commenting out this line works

 cache.restore(JSON.parse(JSON.stringify(nuxt.payload.data["apollo-" + clientId])));

Screenshot from 2022-07-20 14-02-20

Not sure why this happened

steinathan commented 2 years ago

Forking and adding replacing this line temporarily fixed my problem

      const cacheData = JSON.stringify(nuxt.payload.data["apollo-" + clientId] ?? {})
      cache.restore(JSON.parse(cacheData));
Luferov commented 2 years ago

Forking and adding replacing this line temporarily fixed my problem

      const cacheData = JSON.stringify(nuxt.payload.data["apollo-" + clientId] ?? {})
      cache.restore(JSON.parse(cacheData));

Could you send PR?