mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-21 11:45:59 +00:00
optimalization
This commit is contained in:
@@ -95,11 +95,15 @@ export { OpenedTabsProvider, useOpenedTabs, useSetOpenedTabs };
|
||||
export function useUpdateDatabaseForTab(tabVisible, conid, database) {
|
||||
const connection = useConnectionInfo({ conid });
|
||||
const setDb = useSetCurrentDatabase();
|
||||
const currentDb = useCurrentDatabase();
|
||||
const previousTabVisible = usePrevious(!!(tabVisible && connection));
|
||||
|
||||
if (!conid || !database) return;
|
||||
|
||||
if (!previousTabVisible && tabVisible && connection) {
|
||||
if (currentDb && currentDb.connection && currentDb.connection._id == conid && currentDb.name == database) {
|
||||
return;
|
||||
}
|
||||
setDb({
|
||||
name: database,
|
||||
connection,
|
||||
|
||||
Reference in New Issue
Block a user