Component script in MDX gets loaded in different order compared to regular loading #11219
Open
1 task done
Labels
needs response
Issue needs response from OP
pkg: mdx
Issues pertaining to `@astrojs/mdx` integration
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
The text was updated successfully, but these errors were encountered: