Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

fix(nc-gui): update record issue after drop

Ramesh Mane02ef043051a6
diff --git a/packages/nc-gui/components/smartsheet/grid/canvas/cells/index.ts b/packages/nc-gui/components/smartsheet/grid/canvas/cells/index.ts
index c256d674ab..4e345bbaf7 100644
--- a/packages/nc-gui/components/smartsheet/grid/canvas/cells/index.ts
+++ b/packages/nc-gui/components/smartsheet/grid/canvas/cells/index.ts
@@ -36,6 +36,7 @@ import { FormulaCellRenderer } from './Formula'
import { GenericReadOnlyRenderer } from './GenericReadonlyRenderer'
import { NullCellRenderer } from './Null'
import { PlainCellRenderer } from './Plain'
+import { comparePath } from '../utils/groupby'
const CLEANUP_INTERVAL = 1000
@@ -331,8 +332,10 @@ export function useGridCellHandler(params: {
isRootCell &&
column.uidt === UITypes.Attachment &&
!column.readonly &&
- params.attachmentCellDropOver.value?.columnId === column.id &&
- params.attachmentCellDropOver.value?.rowIndex === rowMeta.rowIndex
+ params.attachmentCellDropOver.value &&
+ comparePath(path, params.attachmentCellDropOver.value.path ?? []) &&
+ params.attachmentCellDropOver.value.columnId === column.id &&
+ params.attachmentCellDropOver.value.rowIndex === rowMeta.rowIndex
) {
roundedRect(ctx, x, y, width, height, 0, {
backgroundColor: '#4A5268BF', // gray-600/75
diff --git a/packages/nc-gui/components/smartsheet/grid/canvas/composables/useCopyPaste.ts b/packages/nc-gui/components/smartsheet/grid/canvas/composables/useCopyPaste.ts
index ca74ed6803..10265809cf 100644
--- a/packages/nc-gui/components/smartsheet/grid/canvas/composables/useCopyPaste.ts
+++ b/packages/nc-gui/components/smartsheet/grid/canvas/composables/useCopyPaste.ts
@@ -75,7 +75,7 @@ export function useCopyPaste({
}>
view: ComputedRef<ViewType | undefined>
meta: Ref<TableType>
- syncCellData: (ctx: { row: number; col?: number; updatedColumnTitle?: string }, path?: Array<number>) => Promise<void>
+ syncCellData: (ctx: { row: number; column?: number; updatedColumnTitle?: string }, path?: Array<number>) => Promise<void>
bulkUpsertRows: (
insertRows: Row[],
updateRows: Row[],
@@ -636,7 +636,7 @@ export function useCopyPaste({
rowObj.row[columnObj.title!] = value
- await syncCellData?.(activeCell.activeCell?.value?.path)
+ await syncCellData?.(activeCell, activeCell?.path)
}
},
args: [clone(activeCell.value), clone(columnObj), clone(rowObj), clone(oldCellValue), result],
@@ -1140,10 +1140,11 @@ export function useCopyPaste({
rowObj.row[columnObj.title!] =
newAttachments.length || oldAttachments.length ? JSON.stringify(oldAttachments.concat(newAttachments)) : null
+
await syncCellData?.(
{
row: attachmentCellDropOver.rowIndex,
- col: attachmentCellDropOver.colIndex,
+ column: attachmentCellDropOver.colIndex,
},
attachmentCellDropOver.path,
)