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: avoid badges with undefined class #2086

Conversation

julien-deramond
Copy link
Contributor

@julien-deramond julien-deramond commented Jul 4, 2024

Description

In the actual Starlight documentation at https://starlight.astro.build/fr/getting-started/, the "New" badge in the sidemenu contains a class named "undefined".

Screenshot 2024-07-04 at 13 44 01

This PR suggests a possible fix in the SidebarSublist Astro component directly to create an empty string if the entry.badge.class var is undefined.

Please note that:

  • I'm not too much familiar with Starlight's codebase, so maybe this fix must be done at another level in the code
  • there's maybe another syntax that would be better for this fix

Don't hesitate to nuke this PR or update it directly if there's a better way to fix that. I can also just close it if the quality is not there, and just create an issue instead :)

Copy link

changeset-bot bot commented Jul 4, 2024

🦋 Changeset detected

Latest commit: cb7c2c0

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

Copy link

vercel bot commented Jul 4, 2024

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

Name Status Preview Updated (UTC)
starlight ✅ Ready (Inspect) Visit Preview Jul 4, 2024 5:39pm

@github-actions github-actions bot added the 🌟 core Changes to Starlight’s main package label Jul 4, 2024
@julien-deramond julien-deramond marked this pull request as ready for review July 4, 2024 11:50
@delucis
Copy link
Member

delucis commented Jul 4, 2024

Thanks @julien-deramond! I remember seeing this bug before and forgot about it.

It’s technically a more general Astro bug, so I opened this issue: withastro/astro#11413

Ideally, we should fix it in Astro so that our usage can remain unchanged (because this bug could impact various Astro users, not only Starlight), but I’ll see what the feedback is on that issue. If it looks like we won’t be able to fix it upstream in a timely manner, we can use this PR in Starlight instead.

@delucis
Copy link
Member

delucis commented Jul 4, 2024

Proposed a fix: withastro/compiler#1014

@delucis
Copy link
Member

delucis commented Jul 8, 2024

This should be fixed by withastro/compiler#1014 in the next release of the compiler.

Thanks again for bringing our attention to it!

@delucis delucis closed this Jul 8, 2024
@julien-deramond
Copy link
Contributor Author

Great job fixing it upstream! 💪

@julien-deramond julien-deramond deleted the main-jd-drop-badge-undefined-class branch July 8, 2024 18:59
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants