Fix transitioning away
Fixes #17 The root problem here, which took me ages to find, was that `state` should not be reactive. It should only be set once the child has finished, via the nesting context.
This commit is contained in:
@@ -140,15 +140,17 @@
|
||||
}
|
||||
|
||||
let _cleanup = null;
|
||||
$: if (mounted) {
|
||||
if (_cleanup) {
|
||||
_cleanup();
|
||||
$: {
|
||||
if (mounted) {
|
||||
if (_cleanup) {
|
||||
_cleanup();
|
||||
}
|
||||
_cleanup = executeTransition(
|
||||
$transitionContext.show,
|
||||
$transitionContext.appear
|
||||
);
|
||||
initial = false;
|
||||
}
|
||||
_cleanup = executeTransition(
|
||||
$transitionContext.show,
|
||||
$transitionContext.appear
|
||||
);
|
||||
initial = false;
|
||||
}
|
||||
|
||||
setContext(NESTING_CONTEXT_NAME, nesting);
|
||||
@@ -164,5 +166,7 @@
|
||||
</script>
|
||||
|
||||
<div bind:this={container} {...$$restProps}>
|
||||
<slot />
|
||||
{#if state === TreeStates.Visible}
|
||||
<slot />
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user