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

Async Props Transfer #2

Open
khpatel4991 opened this issue Feb 13, 2017 · 0 comments
Open

Async Props Transfer #2

khpatel4991 opened this issue Feb 13, 2017 · 0 comments

Comments

@khpatel4991
Copy link

Hi, Thanks for a nice and simple example for dealing with authentication. I have used your scaffold in my project but I found an issue while transferring async props from WrapComponent to the Wrapped Component.
e.g.

class WrapComponent extends Component {
  static async getInitialProps(ctx) {
    const res = await axios.get(`${some_url}`);
    const seed = res.data;
    return { seed };
  }
}

When I wrap the above component with your SecuredPage/Page component, the seed prop is lost when I console log it or try to use it in my wrapped component. I have fixed the issue by using loadGetInitialProps provided by next/dist/lib/utils instead of return Page.getInitialProps ? Page.getInitialProps(context) : {}; Use return await loadGetInitialProps(Page, context);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant