next-with-apollo icon indicating copy to clipboard operation
next-with-apollo copied to clipboard

SSR is working on development but not working after build

Open eleviven opened this issue 3 years ago • 2 comments

Hi, i have problem like below

screen

_app.js

import { getDataFromTree } from "@apollo/client/react/ssr";

function MyApp({ Component, pageProps }) {
  return <Component {...pageProps} />;
}

export default withApollo(MyApp, { getDataFromTree });

hoc/withApollo.js

export default withApollo(
  ({ initialState, headers }) => {
    return new ApolloClient({
      headers,
      credentials: "same-origin",
      uri: `${API_URI}/graphql`,
      cache: new InMemoryCache().restore(initialState || {}),
    });
  },
  {
    render: ({ Page, props }) => {
      return (
        <ApolloProvider client={props.apollo}>
          <Page {...props} />
        </ApolloProvider>
      );
    },
  }
);

eleviven avatar Jan 14 '21 11:01 eleviven