You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If this issue only occurs in one browser, which browser is a problem?
/
Describe the Bug
Astro.slots.has('default') return true, even though the slot is empty.
my usecase:
<List {...list}>
<Socials {socials} />
</List>
after running Astro.slots.render('default') I found out that it returns 2 empty spaces. When changing my component to the following it does work as expected:
<List {...list}> <Socials {socials} /></List>
What's the expected result?
I expect Astro to not count it as a slot if it's just empty spaces. Otherwise we would need to write very uggly code, especially when having a more nested structure. This quickly looks like this:
Pretty sure this is intentional, we just check that the slot exists, it hasn't rendered until you call render(). You can call render() and check for non-whitespace to do the same thing.
Talked about this with some others on the core team and this is indeed expected behavior, has() just says that a slot was passed. Use render() to check on its value.
Astro Info
If this issue only occurs in one browser, which browser is a problem?
/
Describe the Bug
Astro.slots.has('default') return true, even though the slot is empty.
my usecase:
after running Astro.slots.render('default') I found out that it returns 2 empty spaces. When changing my component to the following it does work as expected:
What's the expected result?
I expect Astro to not count it as a slot if it's just empty spaces. Otherwise we would need to write very uggly code, especially when having a more nested structure. This quickly looks like this:
Not only is it way too hard to read, prettier actually wont allow it with the astro plugin.
Link to Minimal Reproducible Example
na
Participation
The text was updated successfully, but these errors were encountered: