Skip to content

Commit

Permalink
fix(lib): conditionally include default slot
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
theetrain committed Aug 29, 2024
1 parent 2a965f3 commit 063ff16
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
1 change: 1 addition & 0 deletions e2e/svelte-4/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions e2e/svelte-5/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions lib/Cartesian.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,13 @@
{/if}
{:else}
<div>
<svelte:component this={Component} {...innerProps}>
<slot />
</svelte:component>
{#if $$slots.default}
<svelte:component this={Component} {...innerProps}>
<slot />
</svelte:component>
{:else}
<svelte:component this={Component} {...innerProps} />
{/if}
</div>
{#if showLabels}
<div>
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 063ff16

Please sign in to comment.