mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-20 12:26:01 +00:00
free table editing operations
This commit is contained in:
@@ -10,6 +10,20 @@ import FreeTableGrid from '../freetable/FreeTableGrid';
|
||||
export default function FreeDataTab({ conid, database, schemaName, pureName, tabVisible, toolbarPortalRef, tabid }) {
|
||||
const [config, setConfig] = useGridConfig(tabid);
|
||||
const [modelState, dispatchModel] = useUndoReducer(createFreeTableModel());
|
||||
const storageKey = `tabdata_freetable_${tabid}`;
|
||||
|
||||
React.useEffect(() => {
|
||||
const existingData = localStorage.getItem(storageKey);
|
||||
if (existingData) {
|
||||
const value = JSON.parse(existingData);
|
||||
// @ts-ignore
|
||||
dispatchModel({ type: 'reset', value });
|
||||
}
|
||||
}, []);
|
||||
|
||||
React.useEffect(() => {
|
||||
localStorage.setItem(storageKey, JSON.stringify(modelState.value));
|
||||
}, [modelState]);
|
||||
|
||||
return (
|
||||
<FreeTableGrid
|
||||
|
||||
Reference in New Issue
Block a user