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

fix: crash when page not found & using multiVersion #987

Closed

Conversation

jbroma
Copy link
Contributor

@jbroma jbroma commented Apr 19, 2024

Summary

When using multiVersion, the useNav hook defaults to 'default' version when version from useVersion is empty. We should first check for defaultVersion in siteData.multiVersion.default before going with default as a key for nav.

Edit: as this happens on 404 page only, it's better to supply defaultVersion from siteData.multiVersion.default in initPageData, similar as it is done for lang. This ensured that:

  • - page doesn't crash in multiVersion setup
  • - when using search.versioned, fetching search index doesn't fail, and fetches default version index
  • - default version is displayed on 404 page version dropdown

Related Issue

closes #986

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copy link

netlify bot commented Apr 19, 2024

Deploy Preview for aquamarine-blini-95325f ready!

Name Link
🔨 Latest commit 57fafe7
🔍 Latest deploy log https://app.netlify.com/sites/aquamarine-blini-95325f/deploys/6625e2a3bd858b000886359d
😎 Deploy Preview https://deploy-preview-987--aquamarine-blini-95325f.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 93 (🟢 up 6 from production)
Accessibility: 97 (no change from production)
Best Practices: 100 (no change from production)
SEO: 92 (no change from production)
PWA: -
View the detailed breakdown and full score reports

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

@jbroma jbroma force-pushed the fix/default-version-when-404 branch from 50cd0fa to 7c648ea Compare April 20, 2024 15:19
@Timeless0911
Copy link
Contributor

image

Seems github API error, but only in this PR, i will try to close this PR first and open another one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: crash when page not found and using multiVersion
2 participants