1
0
Fork 0
mirror of synced 2024-10-06 04:54:52 +13:00

Fix side panel ejection

This commit is contained in:
Andrew Kingston 2022-12-07 09:51:47 +00:00
parent 608576ff3b
commit a846192494

View file

@ -29,6 +29,17 @@
// Derive visibility
$: open = $sidePanelStore.contentId === $component.id
// Derive a render key which is only changed whenever this panel is made
// visible after being hidden. We need to key the content to avoid showing
// stale data when re-revealing a side panel that was closed, but we cannot
// hide the content altogether when hidden as this breaks ejection.
let renderKey = null
$: {
if (open) {
renderKey = Math.random()
}
}
const showInSidePanel = (el, visible) => {
const update = visible => {
const target = document.getElementById("side-panel-container")
@ -60,9 +71,9 @@
class="side-panel"
class:open
>
{#if open}
{#key renderKey}
<slot />
{/if}
{/key}
</div>
<style>