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

🐛 BUG: Component slots in markdown pages throw an error #352

Closed
tony-sull opened this issue Apr 3, 2022 · 3 comments
Closed

🐛 BUG: Component slots in markdown pages throw an error #352

tony-sull opened this issue Apr 3, 2022 · 3 comments

Comments

@tony-sull
Copy link

What version of @astrojs/compiler are you using?

0.14.1

What package manager are you using?

pnpm

What operating system are you using?

mac

Describe the Bug

Ran into a build error when upgrading astro.build to astro@0.26. Narrowed it down to component slots being used in two markdown pages

<!-- src/pages/blog/introducing-astro.md -->
<Blockquote>
  <Fragment slot="quote">
    A well-designed system makes it easy to do the right things and annoying (but not impossible) to do the wrong things
  </Fragment>

  <Fragment slot="cite">Jeff Atwood, <a href="https://blog.codinghorror.com/falling-into-the-pit-of-success/">Falling Into The Pit of Success</a></Fragment>
</Blockquote>

Error message

panic: Element with a slot='...' attribute must be a child of a component or a descendant of a custom element

goroutine 124 [running]:
github.com/withastro/compiler/internal/printer.render1(0x5f9b08, 0x57f860, {0x0, 0x0, 0x3, 0x0, {{0x673e40, 0x8}, {0x4b05f0, 0x4f}, ...}})
	github.com/withastro/compiler/internal/printer/print-to-js.go:409 +0x533

Link to Minimal Reproducible Example

https://github.com/withastro/astro.build/tree/chore/astro-0.26

@JuanM04
Copy link
Contributor

JuanM04 commented Apr 21, 2022

It also happend to me with the slot being inside a conditional:

<MainLayout {...props}>
  <slot />

  {mathStyles && <link rel="stylesheet" href={mathStyles} slot="head" />}
</MainLayout>

@natemoo-re natemoo-re self-assigned this Apr 22, 2022
@natemoo-re
Copy link
Member

Ah that might be the culprit, @JuanM04! I probably won't be able to look at this for another week, but I'd really like to fix this ASAP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@natemoo-re @tony-sull @JuanM04 and others