Browse Source

fix: handle null case

pull/7218/head
Pranav C 12 months ago committed by Ramesh Mane
parent
commit
23eebd05d9
  1. 3
      packages/nc-gui/components/smartsheet/grid/useColumnDrag.ts

3
packages/nc-gui/components/smartsheet/grid/useColumnDrag.ts

@ -34,6 +34,9 @@ export const useColumnDrag = ({
const lastCol = fields.value[fields.value.length - 1] const lastCol = fields.value[fields.value.length - 1]
const lastViewCol = gridViewCols.value[lastCol.id!] const lastViewCol = gridViewCols.value[lastCol.id!]
// if nextToViewCol/toViewCol is null, return
if (nextToViewCol === null || lastViewCol === null) return
const newOrder = nextToViewCol ? toViewCol.order! + (nextToViewCol.order! - toViewCol.order!) / 2 : lastViewCol.order! + 1 const newOrder = nextToViewCol ? toViewCol.order! + (nextToViewCol.order! - toViewCol.order!) / 2 : lastViewCol.order! + 1
const oldOrder = toBeReorderedViewCol.order const oldOrder = toBeReorderedViewCol.order

Loading…
Cancel
Save