Skip to content

Commit 5ebe872

Browse files
committed
simplify
1 parent 0c6b619 commit 5ebe872

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

packages/repl/src/lib/Output/AstNode.svelte

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,17 @@
99
interface Props {
1010
key?: string;
1111
value: Ast;
12-
collapsed?: boolean;
12+
root?: boolean;
1313
path_nodes?: Ast[];
1414
autoscroll?: boolean;
1515
}
1616
17-
let {
18-
key = '',
19-
value,
20-
collapsed = $bindable(true),
21-
path_nodes = [],
22-
autoscroll = true
23-
}: Props = $props();
17+
let { key = '', value, root = false, path_nodes = [], autoscroll = true }: Props = $props();
2418
2519
const { toggleable } = get_repl_context();
2620
21+
let collapsed = $state(!root);
22+
2723
let list_item_el = $state() as HTMLLIElement;
2824
2925
let is_root = $derived(path_nodes[0] === value);

packages/repl/src/lib/Output/AstView.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
<code>
6666
{#if typeof ast === 'object'}
6767
<ul>
68-
<AstNode value={ast} {path_nodes} {autoscroll} collapsed={false} />
68+
<AstNode value={ast} {path_nodes} {autoscroll} root />
6969
</ul>
7070
{:else}
7171
<p>No AST available</p>

0 commit comments

Comments
 (0)