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

[appDir][Dynamic Rendering] Dynamic Data Fetching doesn't seem to be fully working (various bugs in Data Fetching & Route Segment Config Options) #42856

Closed
1 task done
gfortaine opened this issue Nov 13, 2022 · 9 comments
Labels
area: app App directory (appDir: true) bug Issue was opened via the bug report template.

Comments

@gfortaine
Copy link
Contributor

gfortaine commented Nov 13, 2022

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 21.6.0: Thu Sep 29 20:13:56 PDT 2022; root:xnu-8020.240.7~1/RELEASE_ARM64_T6000
Binaries:
  Node: 16.18.1
  npm: 8.19.2
  Yarn: 1.22.19
  pnpm: N/A
Relevant packages:
  next: 13.0.3
  eslint-config-next: N/A
  react: 18.3.0-next-fecc288b7-20221025
  react-dom: 18.3.0-next-fecc288b7-20221025

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

Describe the Bug

It seems that we have had a hard time setting up Dynamic Rendering. Indeed, it looks like that many of the various options are still KO at the time of writing :

At the end of the day, only revalidate with a value of 0 did the trick

Expected Behavior

Options to enable Dynamic Rendering described in the documentation should work :

https://beta.nextjs.org/docs/rendering/static-and-dynamic-rendering#dynamic-rendering

Link to reproduction - Issues with a link to complete (but minimal) reproduction code will be addressed faster

https://github.com/vercel/next-react-server-components

To Reproduce

Clone the repo and use the various options (except revalidate with a value of 0 that is working) in the ItemPage Server Component (/app/item/page.js). Then, you will see the bug when trying to go on the /item page with the following error message :

An item with an ID must be provided as a query parameter.

@gfortaine gfortaine added the bug Issue was opened via the bug report template. label Nov 13, 2022
@gfortaine
Copy link
Contributor Author

gfortaine commented Nov 13, 2022

It seems that the current tests are KO (test/e2e/app-dir/app-static-test.ts, #41505). Indeed, it looks like that we shouldn't use Date.now() to ensure that we have the expected behaviour. Another possibility could be to check if searchParams is correctly handled by the Server Component (like what is done in the repository aforementioned).

@dumbravaandrei22
Copy link

dumbravaandrei22 commented Nov 13, 2022

Same for me!
I use 13.0.3
It seems that everything is statically generated at build time.

@balazsorban44
Copy link
Member

@gfortaine we will look into this. For future reference, please refrain from mass tagging core maintainers. 🙏 💚

@gfortaine
Copy link
Contributor Author

@balazsorban44 As a side note, it seems that the bug appears only in production mode (run build) not in development

@jmcruzmanalo
Copy link

jmcruzmanalo commented Nov 16, 2022

Encountering the same thing, the dynamic option is completely ignored it seems.
image

I've tested as well that revalidate: 0 in fetch calls is one option to force SSR as @gfortaine stated. An alternative I found was to use call import { previewData } from 'next/headers' to force SSR again.

image

A quick note for those using preview mode though, you can't make it work with ISR on the same page component. Since this behavior I noted above will force it to SSR no matter what. I had to use previewData on a separate route for that feature I needed to implement.

@sumiren
Copy link
Contributor

sumiren commented Nov 21, 2022

Same for me.

For me, export const dynamic='force-dynamic' does not work totally now.
Only export const revalidate = 0 works.

I also wonder whether export const dynamic='force-dynamic' is equal to export const revalidate = 0.

At least according to the document, I think expected behavior of export const dynamic='force-dynamic' is equal to export const revalidate = 0, but not sure it's rational.
https://beta.nextjs.org/docs/api-reference/segment-config#dynamic
image

@zenflow
Copy link
Contributor

zenflow commented Dec 22, 2022

@gfortaine fyi

Upgraded to next@13.1.0 and the issue seem to have been fixed.
#43191 (comment)

@dumbravaandrei22
Copy link

Hello!
I can still reproduce this in 13.1.1 and 13.1.2-canary.4 dev and build mode.
@gfortaine Can we reopen this?
If we cannot, I will file a new issue.

Did you manage to solve this using 13.1.1?

@github-actions
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: app App directory (appDir: true) bug Issue was opened via the bug report template.
Projects
None yet
Development

No branches or pull requests

6 participants