Skip to content

Commit e85a44e

Browse files
committed
show toast after circular reference
1 parent 4d3d03e commit e85a44e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

sites/preview/src/lib/components/Tree.svelte

+6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
Tree,
44
type FolderNode,
55
type OnChildrenChangeArgs,
6+
type OnCircularReferenceArgs,
67
type OnDropDestinationChangeArgs,
78
type OnRemoveArgs,
89
type OnResolveNameConflictArgs,
@@ -52,6 +53,10 @@
5253
});
5354
}
5455
56+
function onCircularReference(args: OnCircularReferenceArgs) {
57+
toast.error(`Cannot move "${args.source.node.name}" inside itself`);
58+
}
59+
5560
function canRemove(args: OnRemoveArgs) {
5661
return confirmRemoveDialog!.show({
5762
title: `Are you sure you want to delete ${args.removed.length} item(s)?`,
@@ -94,6 +99,7 @@
9499
{onChildrenChange}
95100
{onDropDestinationChange}
96101
{onResolveNameConflict}
102+
{onCircularReference}
97103
{canRemove}
98104
class={[
99105
"relative grow p-6 focus-visible:outline-2 focus-visible:outline-current",

0 commit comments

Comments
 (0)