mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 23:06:00 +00:00
This commit is contained in:
@@ -9,6 +9,7 @@ import engines from '@dbgate/engines';
|
||||
import useUndoReducer from '../utility/useUndoReducer';
|
||||
import usePropsCompare from '../utility/usePropsCompare';
|
||||
import { useUpdateDatabaseForTab } from '../utility/globalState';
|
||||
import useSocket from '../utility/SocketProvider';
|
||||
|
||||
export default function TableDataTab({ conid, database, schemaName, pureName, tabVisible, toolbarPortalRef }) {
|
||||
const [config, setConfig] = React.useState(createGridConfig());
|
||||
@@ -36,6 +37,23 @@ export default function TableDataTab({ conid, database, schemaName, pureName, ta
|
||||
[connection, config, cache]
|
||||
);
|
||||
|
||||
const handleDatabaseStructureChanged = React.useCallback(() => {
|
||||
setCache(createGridCache());
|
||||
}, []);
|
||||
|
||||
const socket = useSocket();
|
||||
|
||||
React.useEffect(() => {
|
||||
if (display && !display.isLoadedCorrectly) {
|
||||
if (conid && socket) {
|
||||
socket.on(`database-structure-changed-${conid}-${database}`, handleDatabaseStructureChanged);
|
||||
return () => {
|
||||
socket.off(`database-structure-changed-${conid}-${database}`, handleDatabaseStructureChanged);
|
||||
};
|
||||
}
|
||||
}
|
||||
}, [conid, database, display]);
|
||||
|
||||
if (!display) return null;
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user