Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

withPrivateAccess : weird initialProps #68

Closed
Apollinaire opened this issue Sep 21, 2020 · 0 comments
Closed

withPrivateAccess : weird initialProps #68

Apollinaire opened this issue Sep 21, 2020 · 0 comments
Labels
bug Something isn't working

Comments

@Apollinaire
Copy link
Member

These lines seem really weird:

const pageGetInitialProps = PrivatePage.getInitialProps;
/**
* At the time of writing, using getServerSideProps would be cleaner, but would disable
* static export.
* Instead we use getInitialProps, and treat SSR as special case
*
*/
PrivatePage.getInitialProps = async (ctx?: NextPageContext) => {
debugNext("Running private page getInitialProps");
const pageInitialProps = pageGetInitialProps
? pageGetInitialProps(ctx)
: {}; // get the page initial props if any
// SCENARIO 2: we are doing dynamic SSR
// We redirect using HTTP

PrivatePage is the component defined above, and it does not have getInitialProps at line 131, then we define it right after. Maybe the boolean pageGetInitialProps should be Page.getInitialProps, where Page is the component given to the hoc as an argument (the actual Page)

@eric-burel eric-burel added the bug Something isn't working label Sep 21, 2020
eric-burel added a commit that referenced this issue Oct 12, 2020
fix #68 : withPrivatePage calls Page.getInitialProps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants