Skip to content

Commit c5276f6

Browse files
committed
refac
1 parent 8acce14 commit c5276f6

1 file changed

Lines changed: 6 additions & 13 deletions

File tree

src/lib/components/workspace/Models/BuiltinTools.svelte

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,6 @@
5656
const allTools = Object.keys(toolLabels);
5757
5858
export let builtinTools: Record<string, boolean> = {};
59-
60-
// Initialize missing keys to true (default enabled)
61-
$: {
62-
for (const tool of allTools) {
63-
if (!(tool in builtinTools)) {
64-
builtinTools[tool] = true;
65-
}
66-
}
67-
}
6859
</script>
6960

7061
<div>
@@ -77,10 +68,12 @@
7768
<Checkbox
7869
state={builtinTools[tool] !== false ? 'checked' : 'unchecked'}
7970
on:change={(e) => {
80-
builtinTools = {
81-
...builtinTools,
82-
[tool]: e.detail === 'checked'
83-
};
71+
if (e.detail === 'checked') {
72+
delete builtinTools[tool];
73+
} else {
74+
builtinTools[tool] = false;
75+
}
76+
builtinTools = builtinTools;
8477
}}
8578
/>
8679

0 commit comments

Comments
 (0)