-
-
Notifications
You must be signed in to change notification settings - Fork 585
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
Add support for component overrides #638
Conversation
|
✅ Deploy Preview for astro-starlight ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
(omg omg omg the excitement is real ❗) |
Hey @TheOtterlord! Wanted to thank you for kicking this off. We’ll probably have to go a slightly different direction to support all the features we want though. Overriding loading like this, similar to Vite’s
Pretty sure we also don’t want people to end up importing all these various component-specific prop types and have varies access to the route context depending on which component they’re in. I’ve been doing some work on the https://github.com/withastro/starlight/tree/dx-326/component-customization branch to refactor our internal codebase and standardise all components to receive a single consistent props object. There are a couple of exceptions to this in our recursive list components for the sidebar and table of contents, but on the whole it works well. Currently prototyping an override system locally and I think the best solution is to use a virtual module. Basic flow:
This means that a user can still get the original implementation by importing it directly, while we can override components as needed. |
Yep, I like this. I had a similar plan for forwarding components, but I like the prop standardisation too. I'll close this PR, and the efforts can continue in https://github.com/withastro/starlight/tree/dx-326/component-customization |
Thanks @TheOtterlord! Sorry to not have got this feedback to you earlier. But still super helpful to see this prototyped. I didn’t have the |
What kind of changes does this PR include?
Description
Todo
@astrojs/starlight/internal
?)