Skip to content

Commit f22784b

Browse files
committed
Generic fix for the <RollViewer/> not always updating
This is bit of a kludge to address the problem of the `<RollViewer/>` component getting into an inconsistent state if it's not destroyed properly when a new roll is selected. The problem is caused when `<RollViewer/>`s lifecycle `onDestroy` method is not called, which can happen when it's removed while one or more of its children are in the middle of a `transition` (see sveltejs/svelte#5268). One option would be to remove all Svelte `transition`s on child elements (the "Downloading roll image..." message, `<RollViewerControls/>`, and `<RollViewerScaleBar/>`) but this seems a shame. In my testing, this fix seems to address the problem without needing to remove the `transition`s.
1 parent fb72ec0 commit f22784b

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/Pianolatron.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@
162162
};
163163
164164
const resetApp = () => {
165+
rollViewer?.$destroy();
165166
mididataReady = false;
166167
clearNotification();
167168
appReady = false;

0 commit comments

Comments
 (0)