Skip to content

Commit c0c41f8

Browse files
committed
[feat] allow solution to delete dirs/files
1 parent 3d761e1 commit c0c41f8

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/routes/tutorial/[slug]/+page.svelte

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,22 @@
5050
let completing = false;
5151
let path = '/';
5252
53-
$: b = { ...data.section.a, ...data.section.b };
53+
/** @type {Record<string, import('$lib/types').Stub>} */
54+
let b;
55+
$: {
56+
b = { ...data.section.a };
57+
for (const key in data.section.b) {
58+
if (key.endsWith('__delete')) {
59+
for (const k in b) {
60+
if (k.startsWith(key.slice(0, -'/__delete'.length))) {
61+
delete b[k];
62+
}
63+
}
64+
} else {
65+
b[key] = data.section.b[key];
66+
}
67+
}
68+
}
5469
5570
/** @type {import('$lib/types').FileTreeContext} */
5671
const { select } = setContext('filetree', {

0 commit comments

Comments
 (0)