diff --git a/packages/api/src/proc/databaseConnectionProcess.js b/packages/api/src/proc/databaseConnectionProcess.js
index ede62818..3c6f0b1f 100644
--- a/packages/api/src/proc/databaseConnectionProcess.js
+++ b/packages/api/src/proc/databaseConnectionProcess.js
@@ -43,7 +43,7 @@ async function handleFullRefresh() {
loadingModel = false;
}
-async function handleIncrementalRefresh() {
+async function handleIncrementalRefresh(forceSend) {
loadingModel = true;
const driver = requireEngineDriver(storedConnection);
setStatusName('checkStructure');
@@ -51,8 +51,12 @@ async function handleIncrementalRefresh() {
analysedTime = new Date().getTime();
if (newStructure != null) {
analysedStructure = newStructure;
+ }
+
+ if (forceSend || newStructure != null) {
process.send({ msgtype: 'structure', structure: analysedStructure });
}
+
process.send({ msgtype: 'structureTime', analysedTime });
setStatusName('ok');
loadingModel = false;
@@ -91,7 +95,7 @@ async function handleConnect({ connection, structure, globalSettings }) {
readVersion();
if (structure) {
analysedStructure = structure;
- handleIncrementalRefresh();
+ handleIncrementalRefresh(true);
} else {
handleFullRefresh();
}
diff --git a/packages/web/src/App.svelte b/packages/web/src/App.svelte
index 7f912b47..ef93b933 100644
--- a/packages/web/src/App.svelte
+++ b/packages/web/src/App.svelte
@@ -1,25 +1,47 @@
-
-
-{#if $settings}
+{#if loaded}
+
+
+
{:else}
-
+
{/if}
diff --git a/packages/web/src/utility/appLoadManager.ts b/packages/web/src/utility/appLoadManager.ts
new file mode 100644
index 00000000..02ac63d7
--- /dev/null
+++ b/packages/web/src/utility/appLoadManager.ts
@@ -0,0 +1,22 @@
+let appIsLoaded = false;
+let onLoad = [];
+
+export function setAppLoaded() {
+ appIsLoaded = true;
+ for (const func of onLoad) {
+ func();
+ }
+ onLoad = [];
+}
+
+export function getAppLoaded() {
+ return appIsLoaded;
+}
+
+export function callWhenAppLoaded(callback) {
+ if (appIsLoaded) {
+ callback();
+ } else {
+ onLoad.push(callback);
+ }
+}
diff --git a/packages/web/src/utility/changeCurrentDbByTab.ts b/packages/web/src/utility/changeCurrentDbByTab.ts
index 9a93f739..e505d591 100644
--- a/packages/web/src/utility/changeCurrentDbByTab.ts
+++ b/packages/web/src/utility/changeCurrentDbByTab.ts
@@ -1,10 +1,11 @@
import _ from 'lodash';
import { currentDatabase, openedTabs } from '../stores';
+import { callWhenAppLoaded } from './appLoadManager';
import { getConnectionInfo } from './metadataLoaders';
let lastCurrentTab = null;
-openedTabs.subscribe(async value => {
+openedTabs.subscribe(value => {
const newCurrentTab = (value || []).find(x => x.selected);
if (newCurrentTab == lastCurrentTab) return;
@@ -15,11 +16,14 @@ openedTabs.subscribe(async value => {
database &&
(conid != _.get(lastCurrentTab, 'props.conid') || database != _.get(lastCurrentTab, 'props.database'))
) {
- const connection = await getConnectionInfo({ conid });
- currentDatabase.set({
- connection,
- name: database,
- });
+ const doWork = async () => {
+ const connection = await getConnectionInfo({ conid });
+ currentDatabase.set({
+ connection,
+ name: database,
+ });
+ };
+ callWhenAppLoaded(doWork);
}
}