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

feat: implement appDir #90

Merged
merged 1 commit into from Nov 24, 2022
Merged

feat: implement appDir #90

merged 1 commit into from Nov 24, 2022

Conversation

stipsan
Copy link
Member

@stipsan stipsan commented Nov 21, 2022

Preview Deploy link

Blocked by:

  • All Document/HTML requests are always missing cache, verify by looking at x-vercel-cache which is MISS but should be HIT like it is on the main.
  • When in production (next build && next start) and SANITY_REVALIDATE_SECRET isn't set, an error is thrown when trying to view a post:
    Error: invariant: invalid Cache-Control duration provided: 0 < 1
  • When running locally (next dev) the post pages throw this error:
    Error: Dynamic server usage: previewData

previewData blockers worked around, revisit in #95 once Next 13 is shipping an updated previewData() mechanic.

@vercel
Copy link

vercel bot commented Nov 21, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
nextjs-blog-cms-sanity-v3 ✅ Ready (Inspect) Visit Preview Nov 24, 2022 at 5:48PM (UTC)

@kmelve
Copy link
Member

kmelve commented Nov 21, 2022

📝 Changed routes:

2 deleted routes:

  • /
  • /posts/[slug]

Commit 59b7c4c (https://nextjs-blog-cms-sanity-v3-px1r941v9.sanity.build).

@arduano
Copy link

arduano commented Nov 22, 2022

Hi, with the cache control error that you listed as blocking, I was debugging the same error yesterday in my own project and I traced it down to a single usePathname call when ISR is enabled and a non cached page is fetched. I double checked entirely in isolation in a new test project to reproduce it. Also the error went away when I updated nextjs and react to the latest versions too. Your cause may be different but hopefully this helps.

@stipsan
Copy link
Member Author

stipsan commented Nov 22, 2022

@arduano in this case it's calling previewData() that causes the bailout.

If you remove all the previewData() calls then things work like they do on main. You'll get a 60min TTL on the home page and slug pages, where it regens in the background and returns a STALE header whenever the TTL expires and you make a request.
Here's a deploy for you to check the cache headers.

app/head.tsx Outdated Show resolved Hide resolved
Copy link

@leerob leerob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code is looking really good!

@stipsan stipsan merged commit b07bcda into main Nov 24, 2022
@stipsan stipsan deleted the rsc branch November 24, 2022 17:53
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants