File tree 4 files changed +16
-12
lines changed
sites/preview/src/lib/components/tree
4 files changed +16
-12
lines changed Original file line number Diff line number Diff line change 16
16
}
17
17
18
18
export function show(args : ShowArgs ): void {
19
- if (showArgs !== undefined ) {
20
- throw new Error (" Dialog is already open" );
21
- }
22
-
23
19
showArgs = args ;
24
20
}
25
21
Original file line number Diff line number Diff line change 19
19
}
20
20
21
21
export function show(args : ShowArgs ): void {
22
- if (showArgs !== undefined ) {
23
- throw new Error (" Dialog is already open" );
24
- }
25
-
26
22
showArgs = args ;
27
23
name = args .initialName ;
28
24
}
Original file line number Diff line number Diff line change 120
120
title: " Rename" ,
121
121
initialName: target .node .name ,
122
122
onSubmit : async (name ) => {
123
+ if (nameFormDialog === null ) {
124
+ throw new Error (" Dialog is not mounted" );
125
+ }
126
+
123
127
if (name === target .node .name ) {
124
- nameFormDialog ? .close ();
128
+ nameFormDialog .close ();
125
129
return ;
126
130
}
127
131
135
139
136
140
const didRename = await onRenameItem ({ target , name });
137
141
if (didRename ) {
138
- nameFormDialog ? .close ();
142
+ nameFormDialog .close ();
139
143
}
140
144
},
141
145
});
185
189
title: " New Folder" ,
186
190
initialName: " " ,
187
191
onSubmit : (name ) => {
192
+ if (nameFormDialog === null ) {
193
+ throw new Error (" Dialog is not mounted" );
194
+ }
195
+
188
196
for (const child of target .children ) {
189
197
if (child .name === name ) {
190
198
showAlreadyExistsToast (name );
198
206
children: [],
199
207
});
200
208
target .children .push (node );
201
- nameFormDialog ? .close ();
209
+ nameFormDialog .close ();
202
210
},
203
211
});
204
212
}
Original file line number Diff line number Diff line change 73
73
74
74
$effect (() => {
75
75
return () => {
76
- contextMenu ?.onItemDestroyed (item );
76
+ if (contextMenu === null ) {
77
+ throw new Error (" Context menu is not mounted" );
78
+ }
79
+
80
+ contextMenu .onItemDestroyed (item );
77
81
};
78
82
});
79
83
</script >
You can’t perform that action at this time.
0 commit comments