-
Notifications
You must be signed in to change notification settings - Fork 30k
Description
Feature request
When using a next export static build, I would like the getInitialProps method to fire only during the build step and not on the client for select page components. (Related StackOverflow question)
On a static client, Next.js invokes this method before the page component is rendered in order to provide the necessary props for the component. Thus, large requests can delay the client's first paint as this is a blocking request.
I would like to selectively ignore getInitialProps for a page component, and instead use the props provided by getInitialProps during next export.
I'm unwilling to move my slow API request to componentDidMount in order to avoid the blocking request because I want to use the data returned during the build step to populate the static HTML, and this particular request doesn't need to be dynamic or updated after the build.
Shallow routing works only for same page URL changes.
For this feature request, is it possible to implement something similar to shallow routing, but for new pages?
To circumvent getInitialProps on static exports, I currently have to use a standard JSX anchor <a href="/next-page"> to avoid invoking the method. This does cause a full page refresh which is a poor solution.