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.

Support for `getServerSideProps`

See original GitHub issue

Is your feature request related to a problem? Please describe.

When using getServerSideProps as opposed to getInitialProps results in a namespacesRequired warning, despite the fact that I am returning namespacesRequired inside the required props key

I don’t know if this is factual or not, or if the warning is a red herring

Describe the solution you’d like

Ideally I’d like getServerSideProps to be supported.

Apologies if this is vague or unclear, or a completely unreasonable request.

Thanks in advance

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:95
  • Comments:43 (18 by maintainers)

github_iconTop GitHub Comments

35reactions
icronacommented, Jun 16, 2020

since we cant use serverSideProps together with initialProps. we can make use of React FunctionComponent.defaultProps here is the workaround that works for me, and it still works with initialProps (https://github.com/isaachinman/next-i18next/issues/615#issuecomment-575578375)

  1. particular page
Page.defaultProps = {
      i18nNamespaces: ['home-page']
}
  1. main app / _app.tsx
MyApp.getInitialProps = async (appContext: AppContextType<Router>) => {
    const appProps = await App.getInitialProps(appContext)
    const defaultProps = appContext.Component.defaultProps
    return {
        ...appProps,
        pageProps: {
            namespacesRequired: [...(appProps.pageProps.namespacesRequired || []), ...(defaultProps?.i18nNamespaces || [])]
        }
    }
}
29reactions
isaachinmancommented, Mar 18, 2020

I do not currently have much time for development on this project due to other factors in life. I don’t see this changing for the next few weeks, at least.

As I’ve stated, next-i18next will be rewritten once plugin support (finally) lands. If you’d like to see this (and many other features) supported, please let the NextJs team know that you are waiting for plugin support!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Data Fetching: getServerSideProps - Next.js
This new directory has support for colocated data fetching at the component level, using the new React use hook and an extended fetch...
Read more >
Support for `getServerSideProps` · Issue #652 · i18next ...
Ideally I'd like getServerSideProps to be supported. Apologies if this is vague or unclear, or a completely unreasonable request.
Read more >
What is Next.js getInitialProps and getServerSideProps? | refine
js provides getServerSideProps (server-side Rendering) with caching capabilities that help improve server response times and reduces the number ...
Read more >
Next.js Tutorial - 34 - getServerSideProps context - YouTube
Courses - https://learn.codevolution.dev/⚡️ Checkout Taskade! https://www.taskade.com/ Support UPI - https:// support.codevolution.dev/  ...
Read more >
NEXTJS: getServerSideProps not working into components
You cannot use getServerSideProps in non-page components. You can either pass the prop from Home to HomeSection or create a context so the ......
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