Skip to content

fix: ensure isr conditional 404 fix works for next 11 #1765

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

Closed
wants to merge 12 commits into from

Conversation

orinokai
Copy link
Contributor

@orinokai orinokai commented Nov 11, 2022

Summary

A previous PR that fixed an issue with fallback: false also patched the Next server so that 404 pages could return a SWR header and so ISR pages that conditionally 404 will still have a TTL. However, it seems this patch was not compatible with Next 11. This PR addresses that.

Test plan

Tests have been added as a new Next 11 demo site and should run and pass.

Relevant links (GitHub issues, Notion docs, etc.) or a picture of cute animal

#1541

@netlify
Copy link

netlify bot commented Nov 11, 2022

Deploy Preview for netlify-plugin-nextjs-static-root-demo ready!

Name Link
🔨 Latest commit e4256a6
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-static-root-demo/deploys/63986db3bbf3fd00090d18d5
😎 Deploy Preview https://deploy-preview-1765--netlify-plugin-nextjs-static-root-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@github-actions github-actions bot added the type: bug code to address defects in shipped code label Nov 11, 2022
@netlify
Copy link

netlify bot commented Nov 11, 2022

Deploy Preview for netlify-plugin-nextjs-demo ready!

Name Link
🔨 Latest commit e4256a6
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-demo/deploys/63986db44773de000934c2d5
😎 Deploy Preview https://deploy-preview-1765--netlify-plugin-nextjs-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Nov 11, 2022

Deploy Preview for next-i18next-demo ready!

Name Link
🔨 Latest commit e4256a6
🔍 Latest deploy log https://app.netlify.com/sites/next-i18next-demo/deploys/63986db33e8d120008294bff
😎 Deploy Preview https://deploy-preview-1765--next-i18next-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Nov 11, 2022

Deploy Preview for next-plugin-edge-middleware ready!

Name Link
🔨 Latest commit e4256a6
🔍 Latest deploy log https://app.netlify.com/sites/next-plugin-edge-middleware/deploys/63986db3af58ce0009564c18
😎 Deploy Preview https://deploy-preview-1765--next-plugin-edge-middleware.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Nov 11, 2022

Deploy Preview for netlify-plugin-nextjs-next-auth-demo ready!

Name Link
🔨 Latest commit e4256a6
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-next-auth-demo/deploys/63986db3e4f90d00089557c8
😎 Deploy Preview https://deploy-preview-1765--netlify-plugin-nextjs-next-auth-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Nov 11, 2022

Deploy Preview for next-plugin-canary ready!

Name Link
🔨 Latest commit e4256a6
🔍 Latest deploy log https://app.netlify.com/sites/next-plugin-canary/deploys/63986db4ee28fe000832ddae
😎 Deploy Preview https://deploy-preview-1765--next-plugin-canary.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Nov 11, 2022

Deploy Preview for nextjs-plugin-custom-routes-demo ready!

Name Link
🔨 Latest commit e4256a6
🔍 Latest deploy log https://app.netlify.com/sites/nextjs-plugin-custom-routes-demo/deploys/63986db44915db0008b98a85
😎 Deploy Preview https://deploy-preview-1765--nextjs-plugin-custom-routes-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Nov 11, 2022

Deploy Preview for netlify-plugin-nextjs-nx-monorepo-demo ready!

Name Link
🔨 Latest commit e4256a6
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-nx-monorepo-demo/deploys/63986db34915db0008b98a80
😎 Deploy Preview https://deploy-preview-1765--netlify-plugin-nextjs-nx-monorepo-demo.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Nov 11, 2022

Deploy Preview for netlify-plugin-nextjs-export-demo ready!

Name Link
🔨 Latest commit e4256a6
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-export-demo/deploys/63986db3ee28fe000832dda9
😎 Deploy Preview https://deploy-preview-1765--netlify-plugin-nextjs-export-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@orinokai orinokai marked this pull request as ready for review November 14, 2022 20:24
@orinokai orinokai requested a review from a team November 14, 2022 20:24
sarahetter
sarahetter previously approved these changes Nov 14, 2022
Copy link

@sarahetter sarahetter left a comment

Choose a reason for hiding this comment

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

LGTM

@orinokai orinokai requested a review from sarahetter November 14, 2022 20:45
@orinokai orinokai marked this pull request as draft November 14, 2022 20:47
@orinokai orinokai marked this pull request as ready for review November 14, 2022 20:47
@netlify
Copy link

netlify bot commented Nov 14, 2022

Deploy Preview for nextjs-plugin-next-11-demo ready!

Name Link
🔨 Latest commit d7ea3fb
🔍 Latest deploy log https://app.netlify.com/sites/nextjs-plugin-next-11-demo/deploys/63738bc95ca9c30008715b9a
😎 Deploy Preview https://deploy-preview-1765--nextjs-plugin-next-11-demo.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

nickytonline
nickytonline previously approved these changes Nov 14, 2022
Copy link

@nickytonline nickytonline left a comment

Choose a reason for hiding this comment

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

🚀

@orinokai orinokai marked this pull request as draft November 15, 2022 10:47
Copy link

@ericapisani ericapisani left a comment

Choose a reason for hiding this comment

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

Know this is still in a draft state, but noticed a few small things

strategy:
fail-fast: false
matrix:
containers: [1, 2, 3, 4]

Choose a reason for hiding this comment

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

If there's not many tests that are included in this suite, it's likely not worth having so many containers dedicated to this. However, I'd leave it as a matrix so that as we add more tests it's really easy to add containers to keep the time to run the tests low.

Suggested change
containers: [1, 2, 3, 4]
containers: [1]

@@ -0,0 +1,4 @@
{
"extends": "next",
"root": true

Choose a reason for hiding this comment

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

In case anyone else is interested in what this property does (because I didn't know offhand either), from the ESLint docs site:

By default, ESLint looks for configuration files in all parent folders up to the root directory. This can be useful if you want all of your projects to follow a certain convention, but can sometimes lead to unexpected results. To limit ESLint to a specific project, place "root": true inside the .eslintrc.* file or eslintConfig field of the package.json file or in the .eslintrc.* file at your project’s root level. ESLint stops looking in parent folders once it finds a configuration with "root": true.

@orinokai This is a bit of a nitpick, but it might be worth adding a small note here about ESLint not looking for configuration in parent directories past this point with this setting since this info is a little buried in the docs

ignore = "if [ $CACHED_COMMIT_REF == $COMMIT_REF ]; then (exit 1); else git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF ../..; fi;"

[[plugins]]
package = "@netlify/plugin-nextjs"

Choose a reason for hiding this comment

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

I don't think this needs to be included since

[[plugins]]
package = "@netlify/plugin-local-install-core"


[[plugins]]
package = "../plugin-wrapper"

is present in the file

@nickytonline
Copy link

Going to go ahead and close this for now as we've done other work for 404s in relation to ISR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug code to address defects in shipped code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants