Use order as key when registering block components rather than ID

This commit is contained in:
Andrew Kingston 2022-08-23 19:37:38 +01:00
parent 4957f335b7
commit 2f2c28cf4d
2 changed files with 2 additions and 2 deletions

View File

@ -14,7 +14,7 @@
} }
// Remove existing instance of this component in case props changed // Remove existing instance of this component in case props changed
structureLookupMap[parentId] = structureLookupMap[parentId].filter( structureLookupMap[parentId] = structureLookupMap[parentId].filter(
blockComponent => blockComponent.instance._id !== id blockComponent => blockComponent.order !== order
) )
// Add new instance of this component // Add new instance of this component
structureLookupMap[parentId].push({ order, instance }) structureLookupMap[parentId].push({ order, instance })

View File

@ -39,7 +39,7 @@
// ejected later // ejected later
$: { $: {
if ($builderStore.inBuilder) { if ($builderStore.inBuilder) {
block.registerComponent(id, order, $component?.id, instance) block.registerComponent(id, order ?? 0, $component?.id, instance)
} }
} }
</script> </script>