chore: update editing cell

This commit is contained in:
ascarbek 2023-03-24 20:53:45 +06:00
parent 5ddb5100ad
commit bd8d816862
2 changed files with 6 additions and 1 deletions

View File

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

View File

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