-
-
Notifications
You must be signed in to change notification settings - Fork 206
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
Using getInitialProps in a simple page #453
Comments
@VictorAssis Are you using a HoC on the You can just write an empty |
@aralroca I'm not using HoC on the I tried to add a empty getStaticProps (returning nothing or a empty props) on the page, but i receive the same warning and the error:
|
@VictorAssis it looks related to this issue: #444 Is detecting the word Naturally, this needs to be improved and that's why I created the other issue. Improving the detection will fix this. Thanks for reporting the issue. As a workaround, meanwhile, you can use string concatenation, something like |
Hello, thanks for your work. We're seeing this issue even in pages not using the word getInitialProps at all. |
@VictorAssis @CleverUpEng we did some improvements on the internal |
This is still happening on 1.0.2-canary.9 |
My workaround is to add this: export function getServerSideProps() { return { props: {} }; } |
Maybe not 100% related to this topic but I encountered some
You also get:
The workaround is the same mentioned in the comment above. |
I can confirm that I also encountered issues while using TypeScript export const getStaticProps: GetStaticProps = async () => {
return { props: {} }
} Obviously, it would be better to fix this bug, so we can avoid using this workaround, at least it is working. |
This will be fixed after this PR in Next.js vercel/next.js#21930 |
Should be fixed in Next.js canary 10.2.1-canary.4 Can someone confirm it? |
I'm still getting the same error:
The 404 page:
|
|
Warning logs are no longer shown after upgrading to next-translate@1.0.7 🎉 :
|
I'm still having a similar issue on the 404 page (next-translate v1.1.0)
This is my import React from "react";
import { useTypeSafeTranslation } from "../hooks/useTypeSafeTranslation";
interface NotFoundPageProps {}
const NotFoundPage: React.FC<NotFoundPageProps> = () => {
const { t } = useTypeSafeTranslation("common");
return <div>{t("404.notFound")}</div>;
};
export default NotFoundPage; A dirty workaround is just to export an empty export const getStaticProps: GetStaticProps = async () => {
return {
props: {},
};
}; btw, |
This should be solved in https://github.com/aralroca/next-translate/releases/tag/2.0.0-experimental.2 do you can confirm? Thanks for your feedback |
Hi, is there a sample of this working with getInitialProps? |
I still experience this problem. The only route
And the AuthContextProvider looks like this:
This is probably related. In the whole app I am neither using getInitialProps, getStaticProps or getServerSideProps next-translate(-plugin): 2.0.5 |
I created a POC with apollo and next-translate before implement in my real project, but when run
yarn build
I am receiving the warning:🚨 [next-translate] In Next 10.x.x there is an issue related to i18n and getInitialProps. We recommend to replace getInitialProps to getServerSideProps on /about.js. Issue: https://github.com/vercel/next.js/issues/18396
But the about page has basically just HTML. Has a way to know why next-translate is detecting getInitialProps?
I created this repository with the code to reproduce the error: https://github.com/VictorAssis/next-translate-bug
The folder
apollo
has the sample without next-translate. Below is the result ofyarn build
in this folder:The folder
apollo-with-translate
has the sample with next-translate. Below is the result ofyarn build
in this folder:My node version is v12.20.1.
The text was updated successfully, but these errors were encountered: