Simplify client app component re-render keying
This commit is contained in:
parent
9febe391bb
commit
495c20f851
|
@ -65,6 +65,7 @@
|
||||||
$: inSelectedPath = $builderStore.selectedComponentPath?.includes(id)
|
$: inSelectedPath = $builderStore.selectedComponentPath?.includes(id)
|
||||||
$: evaluateConditions(enrichedSettings?._conditions)
|
$: evaluateConditions(enrichedSettings?._conditions)
|
||||||
$: componentSettings = { ...enrichedSettings, ...conditionalSettings }
|
$: componentSettings = { ...enrichedSettings, ...conditionalSettings }
|
||||||
|
$: renderKey = `${propsHash}-${emptyState}`
|
||||||
|
|
||||||
// Update component context
|
// Update component context
|
||||||
$: componentStore.set({
|
$: componentStore.set({
|
||||||
|
@ -176,32 +177,30 @@
|
||||||
$: droppable = interactive && !isLayout && !isScreen
|
$: droppable = interactive && !isLayout && !isScreen
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#key propsHash}
|
{#key renderKey}
|
||||||
{#key empty}
|
{#if constructor && componentSettings && (visible || inSelectedPath)}
|
||||||
{#if constructor && componentSettings && (visible || inSelectedPath)}
|
<!-- The ID is used as a class because getElementsByClassName is O(1) -->
|
||||||
<!-- The ID is used as a class because getElementsByClassName is O(1) -->
|
<!-- and the performance matters for the selection indicators -->
|
||||||
<!-- and the performance matters for the selection indicators -->
|
<div
|
||||||
<div
|
class={`component ${id}`}
|
||||||
class={`component ${id}`}
|
class:draggable
|
||||||
class:draggable
|
class:droppable
|
||||||
class:droppable
|
class:empty
|
||||||
class:empty
|
class:interactive
|
||||||
class:interactive
|
data-id={id}
|
||||||
data-id={id}
|
data-name={name}
|
||||||
data-name={name}
|
>
|
||||||
>
|
<svelte:component this={constructor} {...componentSettings}>
|
||||||
<svelte:component this={constructor} {...componentSettings}>
|
{#if children.length}
|
||||||
{#if children.length}
|
{#each children as child (child._id)}
|
||||||
{#each children as child (child._id)}
|
<svelte:self instance={child} />
|
||||||
<svelte:self instance={child} />
|
{/each}
|
||||||
{/each}
|
{:else if emptyState}
|
||||||
{:else if emptyState}
|
<Placeholder />
|
||||||
<Placeholder />
|
{/if}
|
||||||
{/if}
|
</svelte:component>
|
||||||
</svelte:component>
|
</div>
|
||||||
</div>
|
{/if}
|
||||||
{/if}
|
|
||||||
{/key}
|
|
||||||
{/key}
|
{/key}
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
Loading…
Reference in New Issue