Open sdegroot opened 3 months ago
Hey. This issue with the missing renderer looks like it's because you're doing let Content = await render();
rather than let { Content } = await render();
For the other part it looks like you're right about the core of the issue: Alpine is loading before the other parts of the page. I'll defer to someone else to look into this a bit more.
There's not a styles/global.css
in this project. Does this not reflect your real project?
I think this loading is correct. DatePicker.astro
is last because it is dynamically rendered when you do:
let {render} = await getEntry('examples', 'datepicker')
let Content = await render()
All of the other styles are hoisted and known up-front. In general it's not a good idea to have implicit dependencies where you find yourself depending on ordering which can be difficult to reason about.
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
I am loading a date picker component in two ways: directly on pages and through mdx rendering.
Given the following
mdx
file:Results into the following outputted HTML:
Whereas including the date picker in any other location (outside of MDX), it results into the following output:
I get the impression that there is some kind of encoding issue, as you can clearly see a difference between the two script tags:
Because of this bug, the
DatePicker
code is loading after the initialization ofalpine
. Thus resulting into errors.What's the expected result?
The loading of an Astro component should work exactly the same within MDX and outside of MDX. I think the problem may originate in the encoding as mentioned before. Not sure if this does anything with the order?
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-nr2wow-eaomiy
When you check out the provided reproducible example, you will find that the root url shows a working date picker and the two links on that page fail for different reasons.
Participation