Browse Source

fix(gui-v2): skip reordering if children count is 1

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/2888/head
Pranav C 2 years ago
parent
commit
b3a1b7a363
  1. 3
      packages/nc-gui-v2/components/dashboard/TreeView.vue

3
packages/nc-gui-v2/components/dashboard/TreeView.vue

@ -58,6 +58,9 @@ const initSortable = (el: Element) => {
// get the html collection of all list items // get the html collection of all list items
const children: HTMLCollection = evt.to.children const children: HTMLCollection = evt.to.children
// skip if children count is 1
if (children.length < 2) return
// get items before and after the moved item // get items before and after the moved item
const itemBeforeEl = children[newIndex - 1] as HTMLLIElement const itemBeforeEl = children[newIndex - 1] as HTMLLIElement
const itemAfterEl = children[newIndex + 1] as HTMLLIElement const itemAfterEl = children[newIndex + 1] as HTMLLIElement

Loading…
Cancel
Save