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

Feature/app router #213

Merged
merged 21 commits into from
Dec 6, 2023
Merged

Feature/app router #213

merged 21 commits into from
Dec 6, 2023

Conversation

nlkluth
Copy link
Member

@nlkluth nlkluth commented Dec 4, 2023

What

Move to app router

Why

Latest and greatest!

Resources

Migration guide from Vercel team: https://nextjs.org/docs/app/building-your-application/upgrading/app-router-migration

Testing

Need to validate Fastly cache didn't break

Future work

  • Migrate from legacy links
  • Migrate to latest next/image
  • Move use client; to leaf nodes
  • Allow shared-ui to be imported as separate bundles so they don't need to be re-exported
  • migrate api routes

Copy link

vercel bot commented Dec 4, 2023

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

Name Status Preview Comments Updated (UTC)
nextjs-sanity-fe ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 5, 2023 4:54pm

Copy link
Member Author

@nlkluth nlkluth left a comment

Choose a reason for hiding this comment

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

Some notes as you review:

Copy link
Member Author

Choose a reason for hiding this comment

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

From migration guide -- create basic routes and put old pages as client components

Copy link
Member Author

Choose a reason for hiding this comment

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

from migration guide -- old pages are now client side components. Future work entails moving client components to leaf nodes of component tree

Copy link
Member Author

Choose a reason for hiding this comment

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

setCacheHeader was called in serverSideProps [example] but you can no longer do that. Based on this discussion, I've opted for middleware.

🖐️ I need help verifying this will still work with Fastly

@@ -19,7 +19,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16.x
node-version: 18.x
Copy link
Member Author

Choose a reason for hiding this comment

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

Bumped node version as part of these changes here + in our vercel env

Copy link
Member

@scottrippey scottrippey left a comment

Choose a reason for hiding this comment

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

Nice work! Upgrading to app/router isn't as simple as they make it, but this looks good.

packages/nextjs/app/migration/products/[slug].tsx Outdated Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

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

(as mentioned in DMs) Do we have tests that use MSW? Can we get MSW to work with Next 14 / App Router?

Copy link
Member Author

Choose a reason for hiding this comment

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

mswjs/msw#1644 and vercel/next.js#56446 are in ongoing discussions, so this does not currently work 😢

Copy link
Member

Choose a reason for hiding this comment

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

I think we should move forward without fixing it. It’s a good cautionary tale about moving to AppRouter. And it will provide a good challenge in the future, once MSW/Next fixes compatibility.

@nlkluth nlkluth merged commit d97b7a6 into main Dec 6, 2023
7 of 8 checks passed
@nlkluth nlkluth deleted the feature/app-router branch December 6, 2023 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants