Skip to content

Commit

Permalink
fix(urql): temporarily disable ssr
Browse files Browse the repository at this point in the history
  • Loading branch information
dargmuesli committed Aug 22, 2022
1 parent aa2bcf2 commit 0fe17ae
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions nuxt/plugins/urql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,25 @@ import {
jwtRefresh,
} from '~/plugins/util/auth'

const ssrKey = '__URQL_DATA__'
// const ssrKey = '__URQL_DATA__'

export default defineNuxtPlugin(async (nuxtApp) => {
const ssr = ssrExchange({
isClient: process.client,
})

if (process.client) {
nuxtApp.hook('app:created', () => {
ssr.restoreData(nuxtApp.payload[ssrKey])
})
}

if (process.server) {
nuxtApp.hook('app:rendered', () => {
nuxtApp.payload[ssrKey] = ssr.extractData()
})
}
// TODO: Enable when SSR hooks are available in Nuxt bridge or when migrated to Nuxt 3. (https://github.com/maevsi/maevsi/issues/283)
// if (process.client) {
// nuxtApp.hook('app:created', () => {
// ssr.restoreData(nuxtApp.payload[ssrKey])
// })
// }

// if (process.server) {
// nuxtApp.hook('app:rendered', () => {
// nuxtApp.payload[ssrKey] = ssr.extractData()
// })
// }

const cacheConfig: GraphCacheConfig = {
schema,
Expand Down

0 comments on commit 0fe17ae

Please sign in to comment.