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.

SSR called on every page change with getInitialProps

See original GitHub issue

What version of this package are you using? v1.5.0

What operating system, Node.js, and npm version? Node v16.13.2, Next v12.1.6 (tried v12.3.0 too)

What happened? After building the nextjs app, when navigating between routes (even static ones), the ssr is always called and does a refresh on the front. My _app is using getInitialProps.

next-translate - compiled page: /integrations/integrations - locale: en - namespaces: common - used loader: getInitialProps

My current configuration :

module.exports = {
  locales: ["en", "fr"],
  defaultLocale: "en",
  pages: {
    "*": ["common"],
  },
  keySeparator: false,
  nsSeparator: false,
  defaultNS: "common",
};

I’m not using any provider, just the basic config in next.config.js. If I remove the nextTranslate from next.config.js, it change the route only on the client side.

What did you expect to happen? The compilation is called only on the first render, then the client handle the translation.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
DonovanCharpincommented, Oct 19, 2022

Hey @aralroca! Let me try to do that! Also, I’m using next-routes, I don’t know if it can be linked.

0reactions
DonovanCharpincommented, Oct 30, 2022

Follow-up on this issue. It seems that it was linked to next-routes and express, I removed both from the app and now it works!

Read more comments on GitHub >

github_iconTop Results From Across the Web

getInitialProps - Data Fetching - Next.js
getInitialProps enables server-side rendering in a page and allows you to do initial data population, it means sending the page with the data...
Read more >
What is Next.js getInitialProps and getServerSideProps? | refine
getServerSideProps is an asynchronous function used in Next.js pages component for server-side rendering and works almost the same as ...
Read more >
getInitialProps vs. getServerSideProps in Next.js
Explore the differences between getInitialProps and getServerSideProps, two methods for defining props for server-side rendered pages.
Read more >
Is there a method that runs only once server-side on first page ...
I'm new to next.js and I'm looking for a method (similar to getServerSideProps ) that runs just once on the server.
Read more >
Why I Got Rid of getInitialProps in My Next.js Project
In Next.js, getInitialProps enables server-side rendering and can't be statically optimized. It runs every time we open a page. If a page is ......
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