We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ba7fec9 commit 2fc0409Copy full SHA for 2fc0409
src/routes/tutorial/[slug]/+page.svelte
@@ -60,11 +60,19 @@
60
remove: []
61
};
62
for (const key in data.section.b) {
63
- if (key.endsWith('__delete')) {
64
- const to_delete = key.slice(0, -'/__delete'.length);
65
- editing_constraints.remove.push(to_delete);
+ const stub = data.section.b[key];
+
+ if (stub.type === 'file' && stub.contents.startsWith('__delete')) {
66
+ // remove file
67
+ editing_constraints.remove.push(key);
68
+ delete b[key];
69
+ } else if (key.endsWith('/__delete')) {
70
+ // remove directory
71
+ const parent = key.slice(0, key.lastIndexOf('/'));
72
+ editing_constraints.remove.push(parent);
73
+ delete b[parent];
74
for (const k in b) {
- if (k.startsWith(to_delete)) {
75
+ if (k.startsWith(parent + '/')) {
76
delete b[k];
77
}
78
0 commit comments