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 missing styles for dynamic routes rendering <StarlightPage> #2905

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

HiDeoo
Copy link
Member

@HiDeoo HiDeoo commented Feb 19, 2025

Description

This PR introduces a repro for an issue happening when a dyanmic route using a rest parameter renders a <StarlightPage> component. Just by having such setup, an unrelated page, e.g. the home page, rendering a component that includes some styles, will not have the styles applied.

This happens only when the route is using a rest parameter, and the <StarlightPage> component is rendered in the dynamic route. If one of these conditions is not met, the styles are applied correctly.

This is also a dev-only issue, as the production build works as expected.

This PR also includes a potential workaround, which hopefully is not needed but helps understand the issue, by moving the useRouteData function used in routes/common.astro to a dedicated file. At the moment, I've left the original implementation in place so it's easy to change the import path to test the issue and the workaround.

I have not yet understood the root cause of the issue, if we're doing something specific that triggers an issue in Astro (or maybe Vite?) but wanted to share my findings so far.

Notes:

  • The accessibility check is failing due to a random component with some non a11y-friendly styles I added for the repro.
  • If we ever ends up shipping this workaround, we should add an E2E test to ensure we never break it.

Copy link

changeset-bot bot commented Feb 19, 2025

⚠️ No Changeset found

Latest commit: 6528370

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@github-actions github-actions bot added 📚 docs Documentation website changes 🌟 core Changes to Starlight’s main package labels Feb 19, 2025
Copy link

netlify bot commented Feb 19, 2025

Deploy Preview for astro-starlight ready!

Name Link
🔨 Latest commit 6528370
🔍 Latest deploy log https://app.netlify.com/sites/astro-starlight/deploys/67b5b0d0365ba60008c6bd8e
😎 Deploy Preview https://deploy-preview-2905--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: 97 (🔴 down 3 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.

@astrobot-houston
Copy link
Collaborator

Lunaria Status Overview

🌕 This pull request will trigger status changes.

Learn more

By default, every PR changing files present in the Lunaria configuration's files property will be considered and trigger status changes accordingly.

You can change this by adding one of the keywords present in the ignoreKeywords property in your Lunaria configuration file in the PR's title (ignoring all files) or by including a tracker directive in the merged commit's description.

Tracked Files

Locale File Note
en index.mdx Source changed, localizations will be marked as outdated.
Warnings reference
Icon Description
🔄️ The source for this localization has been updated since the creation of this pull request, make sure all changes in the source have been applied.

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 📚 docs Documentation website changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants