This commit is contained in:
Jan Prochazka
2020-05-06 22:03:16 +02:00
parent 54fb4d214d
commit d2fa296139
4 changed files with 46 additions and 28 deletions

View File

@@ -11,11 +11,9 @@ import usePropsCompare from '../utility/usePropsCompare';
import { useUpdateDatabaseForTab } from '../utility/globalState';
export default function TableDataTab({ conid, database, schemaName, pureName, tabVisible, toolbarPortalRef }) {
const tableInfo = useTableInfo({ conid, database, schemaName, pureName });
const [config, setConfig] = React.useState(createGridConfig());
const [cache, setCache] = React.useState(createGridCache());
const [changeSetState, dispatchChangeSet] = useUndoReducer(createChangeSet());
useUpdateDatabaseForTab(tabVisible, conid, database);
const connection = useConnectionInfo({ conid });
// console.log('GOT CONNECTION', connection);
@@ -24,12 +22,18 @@ export default function TableDataTab({ conid, database, schemaName, pureName, ta
const display = React.useMemo(
() =>
tableInfo && connection
? new TableGridDisplay(tableInfo, engines(connection), config, setConfig, cache, setCache, (name) =>
getTableInfo({ conid, database, ...name })
connection
? new TableGridDisplay(
{ schemaName, pureName },
engines(connection),
config,
setConfig,
cache,
setCache,
(name) => getTableInfo({ conid, database, ...name })
)
: null,
[tableInfo, connection, config, cache]
[connection, config, cache]
);
if (!display) return null;