How to use the vue-apollo/ssr.getStates function in vue-apollo

To help you get started, we’ve selected a few vue-apollo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vuejs / vue-apollo / packages / test-ssr / src / entry-server.js View on Github external
context.rendered = () => {
        // Same for Apollo client cache
        context.apolloState = ApolloSSR.getStates(apolloProvider)
      }
      resolve(app)
github Sitecore / jss / samples / vue / server / server.js View on Github external
return renderer.renderToString(app).then((renderedApp) => {
              // We add the GraphQL state to the SSR state so that we can avoid refetching queries after client load
              // Not using GraphQL? Get rid of this.
              state.APOLLO_STATE = ApolloSSR.getStates(graphQLProvider);
              return {
                renderedApp,
                app,
              };
            });
          });
github chanlito / untitled / client / plugins / apollo.ts View on Github external
beforeNuxtRender(({ nuxtState }) => {
      nuxtState.apollo = VueApolloSSR.getStates(apolloProvider);
    });
  }
github vueneue / vueneue / packages / @vueneue / vue-cli-plugin-ssr / generator / templates / apollo / src / plugins / apollo.js View on Github external
async ({ app, router, route, store, ssr, error }) => {
          const matchedComponents = router.getMatchedComponents();

          try {
            await ApolloSSR.prefetchAll(
              app.$apolloProvider,
              [App, ...matchedComponents],
              {
                route,
                store,
              },
            );
            ssr.bodyAdd = ``;
          } catch (err) {
            error(err);
          }
        },
      );