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 invalid locale issue #2548

Merged
merged 4 commits into from
Nov 1, 2024

Conversation

HiDeoo
Copy link
Member

@HiDeoo HiDeoo commented Oct 31, 2024

Description

This PR fixes a build issue visible in withastro/docs#9890

For project without a root locale like the docs, for pages not matching the default locale slug, we were not falling back to the default locale.

I also tested the fix locally on the failing Astro Docs branch and it now builds properly.

Copy link

changeset-bot bot commented Oct 31, 2024

🦋 Changeset detected

Latest commit: 6c426de

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@astrojs/starlight Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the 🌟 core Changes to Starlight’s main package label Oct 31, 2024
Copy link

netlify bot commented Oct 31, 2024

Deploy Preview for astro-starlight ready!

Name Link
🔨 Latest commit 6c426de
🔍 Latest deploy log https://app.netlify.com/sites/astro-starlight/deploys/6724ec6bf6aa74000862d679
😎 Deploy Preview https://deploy-preview-2548--astro-starlight.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: 100 (no change from production)
Accessibility: 100 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (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.

@delucis delucis added the 🌟 patch Change that triggers a patch release label Nov 1, 2024
@HiDeoo
Copy link
Member Author

HiDeoo commented Nov 1, 2024

@delucis Just realized the fix is wrong, please hold on merging

Copy link
Member

@delucis delucis left a comment

Choose a reason for hiding this comment

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

@HiDeoo said the fix is wrong!

@HiDeoo
Copy link
Member Author

HiDeoo commented Nov 1, 2024

To explain with a bit more details, I just realized we actually had 2 implementations of slugToLocale(), 1 tested and the other one not tested, and this PR only updated 1 of them.

I just pushed new changes removing the duplicated code and both code paths now use the same underlying implementation which ends up being tested.

I think there could be some potential reorganization of the code needed, e.g. packages/starlight/integrations/shared/slugToLocale.ts is not only used by integrations. We could do that later in a separate PR or now if preferred but I don't think I now have a clear idea on the structure/naming we could use.

Copy link
Member

@delucis delucis left a comment

Choose a reason for hiding this comment

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

Thanks for catching the duplication!

@delucis
Copy link
Member

delucis commented Nov 1, 2024

I think there could be some potential reorganization of the code needed, e.g. packages/starlight/integrations/shared/slugToLocale.ts is not only used by integrations.

I guess it will depend what else is using these? But for sure I think we can release this fix and refactor later.

@delucis delucis merged commit 07673c8 into withastro:main Nov 1, 2024
15 checks passed
@astrobot-houston astrobot-houston mentioned this pull request Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌟 core Changes to Starlight’s main package 🌟 patch Change that triggers a patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants