Closed poeyer closed 1 year ago
This behavior is because there are some HOC that internally are overwritting the getInitialProps
. This behavior is documented in the README.md that this is in this way just to avoid issues with HOC. If you know that the HOC is fine, you always can do this workaround to force what loader do you want in your page:
export let getStaticProps = undefined
https://github.com/aralroca/next-translate/issues/801#issuecomment-1059800473
What version of this package are you using?
What operating system, Node.js, and npm version?
What happened? Using pages
The plugin checks if the app has a HOC. If you add a custom HOC without
getInitialProps
, the plugin assumes it's a HOC withgetInitialProps
. This makes you opt out of the https://nextjs.org/docs/messages/opt-out-auto-static-optimization because the logic of the Next.js build checks if there is agetInitialProps
or not. ThehasHoc
util must check if the app actually has getInitialProps and only return the HOC template if that's the case.I have this issue with TRPC, you need to have:
export default trpcHoc.withTRPC(App)
When SSR: false, it doesn't do
getInitialProps
What did you expect to happen?
getInitialProps
when there isn't one provided in a HOC.Are you willing to submit a pull request to fix this bug? No