Browse Source

chore: update editing cell

ascarbek 2 years ago
parent
commit
bd8d816862

+ 3 - 0
frontend/appflowy_tauri/src/appflowy_app/components/_shared/EditRow/EditRow.tsx

@@ -78,6 +78,9 @@ export const EditRow = ({
 
     const typeOptionController = new TypeOptionController(viewId, Some(currentField));
     await typeOptionController.switchToField(newType);
+
+    setEditingCell(new CellIdentifier(viewId, rowInfo.row.id, editingCell.fieldId, newType));
+
     setShowChangeFieldTypePopup(false);
   };
 

+ 3 - 1
frontend/appflowy_tauri/src/appflowy_app/components/_shared/database-hooks/useRow.ts

@@ -5,10 +5,12 @@ import { CellIdentifier } from '$app/stores/effects/database/cell/cell_bd_svc';
 import { useEffect, useState } from 'react';
 import { TypeOptionController } from '$app/stores/effects/database/field/type_option/type_option_controller';
 import { None } from 'ts-results';
+import { useAppSelector } from '$app/stores/store';
 
 export const useRow = (viewId: string, databaseController: DatabaseController, rowInfo: RowInfo) => {
   const [cells, setCells] = useState<{ fieldId: string; cellIdentifier: CellIdentifier }[]>([]);
   const [rowController, setRowController] = useState<RowController>();
+  const databaseStore = useAppSelector((state) => state.database);
 
   useEffect(() => {
     if (!databaseController || !rowInfo) return;
@@ -38,7 +40,7 @@ export const useRow = (viewId: string, databaseController: DatabaseController, r
 
       setCells(loadingCells);
     })();
-  }, [rowController]);
+  }, [rowController, databaseStore.columns]);
 
   const onNewColumnClick = async () => {
     if (!databaseController) return;