adamsoffer / adamsoffer/next-apollo
Is it possible to switch getInitialProps to getServerSideProps?
- Lenguaje dominante
- TypeScript
- Estrellas
- 477
- Forks
- 62
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
Well, since this withApollo hoc is using getInitialProps for ssr, there is a conflict when using getServerSideProps on a page component.
```
const Restaurant: NextPage = ({ id }) => {
console.log("id", id);
const { data, loading } = useRestaurantQuery({
variables: {
input: {
restaurantId: id,
},
},
});
console.log("loading", loading);
console.log("data", data);
if (loading) {
return
}
return (
restaurant
);
};
export default withApollo({ssr: true})(Restaurant);
export const getServerSideProps: GetServerSideProps = async (ctx) => {
console.log("ctx", ctx);
const { id } = ctx.query;
if (!id) {
return {
props: {},
};
}
return {
props: { id: parseInt(id as string) },
};
};
```

So, I'm looking for a way to make withApollo hoc utlizing getServerSideProps for "ssr" mode.
Could there be a way to do that?
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Evaluación
Este issue todavía no se ha evaluado.