Skip to content
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

Are getStaticProps and getServerSideProps supported? #62

Open
baleksandr48 opened this issue Sep 27, 2020 · 4 comments
Open

Are getStaticProps and getServerSideProps supported? #62

baleksandr48 opened this issue Sep 27, 2020 · 4 comments
Labels
question Further information is requested

Comments

@baleksandr48
Copy link

baleksandr48 commented Sep 27, 2020

In example I see that you use getInitialProps function. But in the official doc there is an info that it's better to use getStaticProps and getServerSideProps.

I downloaded your example, installed last version of next, replaced getInitialProps -> getStaticProps and started an app.

export const getStaticProps = async (arg) => {
  // arg is {}
};

What I see? The argument is empty object.

After that I opened this official doc (https://nextjs.org/docs/advanced-features/custom-server) and found the next info:

A custom server will remove important performance optimizations, like serverless functions and Automatic Static Optimization.

If I am right, it's exactly what this library do - replace next's server with custom one (from nest js).
So, am I right that if I choose this library, then there will be no ways to cache generated pages and I will have to render it on every request?

Or maybe you have some ideas and in the future versions you are going to implement it?

@baleksandr48
Copy link
Author

Does somebody has any minds about this?

@kyle-mccarthy
Copy link
Owner

getServerSideProps works and can replace the getInitialProps call ; however, I am unsure if getStaticProps will work. I would be curious to see if it works with the beta passthrough feature.

@DiFuks
Copy link

DiFuks commented May 16, 2021

@kyle-mccarthy How does getServerSideProps work? In ctx.query I am getting an empty object and my nest controller is not being called

@DiFuks
Copy link

DiFuks commented May 16, 2021

It is worth clarifying that everything works fine with server rendering. This problem occurs when switching between pages and requests like /_next/data/development/Main.json

@kyle-mccarthy kyle-mccarthy added the question Further information is requested label Nov 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants