question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

getStaticProps and getServerSideProps not working with custom app

See original GitHub issue

When having a custom app having something like this in the render method:

<Component {...pageProps} />

getStaticProps or getServerSideProps do not get called.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:7
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
basslagtercommented, Mar 25, 2020

Yes, as I understand they only work with page components. But is seems to work only if you do not have a custom app setup. I tried it without and it was working fine. With the custom app the getInitialProps only works but the docs state that this is now deprecated.

2reactions
basslagtercommented, Mar 25, 2020

Thanks @ijjk for the response. It turns out thing work as expected with the basics indeed. But…as soon as I do:

export default withRedux(initializeStore)(CustomApp);

Things break. So it looks like the issue is realted to withRedux.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Advanced Features: Custom `App` - Next.js
When you add getInitialProps in your custom app, you must import App from "next/app" , call App.getInitialProps(appContext) inside getInitialProps and merge ...
Read more >
Unable to use getStaticProps in _app.js - Stack Overflow
For that I've exported the getStaticProps from app.js file. But it doesn't seem to work. Here is my app.js. import Layout from ...
Read more >
Fetching and hydrating a Next.JS app using ... - Medium
Fetching and hydrating a Next.JS app using `getServerSideProps` and `getStaticProps` ... First off, this is not a thorough stress analysis.
Read more >
Refreshing Server-Side Props - Next.js - Josh W Comeau
Here's my problem: in my dashboard, I'm able to edit users, to bestow purchases or update their name: Notice how the updated name...
Read more >
getInitialProps vs. getServerSideProps in Next.js
Inner workings of getServerSideProps and getStaticProps ... By making this change, we fix the problem of context switching that occurs with ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found