Skip to content

Commit 666e087

Browse files
committed
Avoid destruction/re-mounting of components on roll-change
Destroying and re-mounting the right sidebar (in particular) when the roll is changed can cause problems if child components aren't destroyed properly due to outro transitions (see sveltejs/svelte#5268). This has caused a number of bugs with the `<RollViewer/>` component not being recreated properly. One option is to eschew all outro transitions in other parts of the app; but I think a better solution in this specific case is to avoid destroying and recreating this part of the component tree unless absolutely necessary.
1 parent 92ad48c commit 666e087

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/Pianolatron.svelte

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -287,25 +287,25 @@
287287
{/if}
288288
{/if}
289289
</FlexCollapsible>
290-
{#if appReady}
291-
<div id="roll">
290+
<div id="roll">
291+
{#if appReady}
292292
<RollViewer
293293
bind:this={rollViewer}
294294
imageUrl={currentRoll.image_url}
295295
{holeData}
296296
{holesByTickInterval}
297297
{skipToTick}
298298
/>
299-
{#if $userSettings.showKeyboard && $userSettings.overlayKeyboard}
300-
<div id="keyboard-overlay" transition:fade>
301-
<Keyboard keyCount="88" {startNote} {stopNote} />
302-
</div>
303-
{/if}
304-
</div>
305-
<FlexCollapsible id="right-sidebar" width="20vw" position="left">
306-
<TabbedPanel {playPauseApp} {stopApp} {skipToPercentage} />
307-
</FlexCollapsible>
308-
{/if}
299+
{/if}
300+
{#if $userSettings.showKeyboard && $userSettings.overlayKeyboard}
301+
<div id="keyboard-overlay" transition:fade>
302+
<Keyboard keyCount="88" {startNote} {stopNote} />
303+
</div>
304+
{/if}
305+
</div>
306+
<FlexCollapsible id="right-sidebar" width="20vw" position="left">
307+
<TabbedPanel {playPauseApp} {stopApp} {skipToPercentage} />
308+
</FlexCollapsible>
309309
</div>
310310
{#if $userSettings.showKeyboard && !$userSettings.overlayKeyboard}
311311
<div id="keyboard-container" transition:slide>

0 commit comments

Comments
 (0)