Skip to content

Commit 063ff16

Browse files
committed
fix(lib): conditionally include default slot
Components that have conditional logic based on the presence of `<slot />` would be challenged by Cartesian adding a `<slot />` element of its own. With this fix, Cartesian will only explicitly pass default `<slot />` contents to the provided component when there are explicitly-included default slot contents.
1 parent 2a965f3 commit 063ff16

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

e2e/svelte-4/package-lock.json

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

e2e/svelte-5/package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/Cartesian.svelte

+7-3
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,13 @@
7171
{/if}
7272
{:else}
7373
<div>
74-
<svelte:component this={Component} {...innerProps}>
75-
<slot />
76-
</svelte:component>
74+
{#if $$slots.default}
75+
<svelte:component this={Component} {...innerProps}>
76+
<slot />
77+
</svelte:component>
78+
{:else}
79+
<svelte:component this={Component} {...innerProps} />
80+
{/if}
7781
</div>
7882
{#if showLabels}
7983
<div>

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)