Skip to content

Commit 8c06fd2

Browse files
committed
fix: components losing props
Apply a fix, but the bug is due to: sveltejs/svelte#9177
1 parent b6954a4 commit 8c06fd2

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

packages/core/src/lib/components/layout/SidePanel.svelte

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,16 @@
6464
style="height: {linesHeights[lineIndex]}px;"
6565
class="msm__line-number {component.type}"
6666
>
67-
{#if lineIndex == 0 && !disableMerging && component.sideAction}
67+
{#if lineIndex == 0 && !disableMerging && component.sideAction && dispatch !== undefined}
6868
<svelte:component
6969
this={component.sideAction.component}
70-
{...component.sideAction.props}
71-
{component}
72-
{dispatch}
70+
{...{ ...component.sideAction.props, dispatch, component }}
7371
/>
72+
<!--
73+
☝️ The weird spread is needed due to a Svelte bug affecting the use of
74+
`<svelte:component>` with spread props and normal ones in v4.
75+
See here for more details: https://github.com/sveltejs/svelte/issues/9177
76+
-->
7477
{/if}
7578

7679
<pre>{startingLineNumber + lineIndex}</pre>

packages/core/src/lib/components/layout/View.svelte

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,13 @@
110110
{#each sideComponents as blockComponent}
111111
<svelte:component
112112
this={blockComponent.component}
113-
component={blockComponent}
114-
{...blockComponent.props}
113+
{...{ ...blockComponent.props, component: blockComponent }}
115114
/>
115+
<!--
116+
☝️ The weird spread is needed due to a Svelte bug affecting the use of
117+
`<svelte:component>` with spread props and normal ones in v4.
118+
See here for more details: https://github.com/sveltejs/svelte/issues/9177
119+
-->
116120
{/each}
117121
</div>
118122

0 commit comments

Comments
 (0)