diff --git a/src/lib/components/custom-property-inspector/CustomPropertyInspector.svelte b/src/lib/components/custom-property-inspector/CustomPropertyInspector.svelte index aa479d9..eb54a8b 100644 --- a/src/lib/components/custom-property-inspector/CustomPropertyInspector.svelte +++ b/src/lib/components/custom-property-inspector/CustomPropertyInspector.svelte @@ -54,11 +54,13 @@ } }) - $effect(() => { + $effect.pre(() => { if (css) { // Reset expanded items when CSS changes to avoid null-pointers + // Runs pre-commit so this reset lands in the same render as the new + // tree_items, instead of a second full-tree render pass right after. expanded.set([]) - // eslint-disable-next-line eslint-plugin-unicorn/no-null + // eslint-disable-next-line eslint-plugin-unicorn/no-null -- null is what Melt UI wants $selectedItem = null search_query = '' } @@ -183,10 +185,12 @@

Properties

- + {#if filtered_results !== undefined && filtered_results.size > 0} + + {/if}
diff --git a/src/lib/components/custom-property-inspector/Tree.svelte b/src/lib/components/custom-property-inspector/Tree.svelte index b80d34b..44702a9 100644 --- a/src/lib/components/custom-property-inspector/Tree.svelte +++ b/src/lib/components/custom-property-inspector/Tree.svelte @@ -19,7 +19,7 @@ } = getContext('tree') -{#each items as { title, count, index, type, children, parent, location, level, name }} +{#each items as { title, count, index, type, children, parent, location, level, name } (type === 'property' ? title : `${title}-${index}`)} {@const item_id = type === 'property' ? title : `${title}-${index}`} {@const has_children = type == 'property'} {@const matches = search_query === '' ? [name] : name.split(search_query)} @@ -67,7 +67,7 @@ {/if} - {#if has_children && children} + {#if has_children && children && $isExpanded(item_id)}
@@ -77,7 +77,8 @@