From d49cb2786f02d05aea0111144d5ef5241b3d21d8 Mon Sep 17 00:00:00 2001 From: Bobby Wang Date: Tue, 23 Jan 2024 07:28:48 +0800 Subject: [PATCH] fix table sort does not work if table has formula column --- src/atoms/tableScope/rowActions.ts | 12 +----------- src/components/fields/Formula/TableSourcePreview.ts | 2 -- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/src/atoms/tableScope/rowActions.ts b/src/atoms/tableScope/rowActions.ts index af5caddf..3baeaf0d 100644 --- a/src/atoms/tableScope/rowActions.ts +++ b/src/atoms/tableScope/rowActions.ts @@ -386,9 +386,7 @@ export const updateFieldAtom = atom( ); if (!row) throw new Error("Could not find row"); - const isLocalRow = - fieldName.startsWith("_rowy_formulaValue_") || - Boolean(find(tableRowsLocal, ["_rowy_ref.path", path])); + const isLocalRow = Boolean(find(tableRowsLocal, ["_rowy_ref.path", path])); const update: Partial = {}; @@ -469,14 +467,6 @@ export const updateFieldAtom = atom( deleteFields: deleteField ? [fieldName] : [], }); - // TODO(han): Formula field persistence - // const config = find(tableColumnsOrdered, (c) => { - // const [, key] = fieldName.split("_rowy_formulaValue_"); - // return c.key === key; - // }); - // if(!config.persist) return; - if (fieldName.startsWith("_rowy_formulaValue")) return; - // If it has no missingRequiredFields, also write to db // And write entire row to handle the case where it doesn’t exist in db yet if (missingRequiredFields.length === 0) { diff --git a/src/components/fields/Formula/TableSourcePreview.ts b/src/components/fields/Formula/TableSourcePreview.ts index 3cf762f7..c31281d1 100644 --- a/src/components/fields/Formula/TableSourcePreview.ts +++ b/src/components/fields/Formula/TableSourcePreview.ts @@ -6,9 +6,7 @@ import { _deleteRowDbAtom, _updateRowDbAtom, tableNextPageAtom, - tableRowsAtom, tableRowsDbAtom, - tableRowsLocalAtom, tableScope, tableSettingsAtom, } from "@src/atoms/tableScope";