diff --git a/app/web/src/newhotness/Workspace.vue b/app/web/src/newhotness/Workspace.vue index 917fa84845..fab521ffa3 100644 --- a/app/web/src/newhotness/Workspace.vue +++ b/app/web/src/newhotness/Workspace.vue @@ -33,7 +33,7 @@ :changeSetId="changeSetId" :componentId="componentId" :viewId="viewId" - connected + :connected="haveWSConn" /> @@ -236,10 +236,9 @@ const changeSetId = computed(() => props.changeSetId); const coldStartInProgress = computed(() => heimdall.muspelheimInProgress.value); -// const haveWSConn = computed(() => { -// if (!heimdall.initCompleted.value) return true; // dont show error if we havent gotten started -// return !!heimdall.wsConnections.value[props.workspacePk]; -// }); +const haveWSConn = computed(() => { + return !!heimdall.wsConnections.value[props.workspacePk]; +}); // no tan stack queries hitting sqlite until after the cold start has finished const queriesEnabled = computed( @@ -637,11 +636,42 @@ watch( return; } await heimdall.registerBearerToken(newWorkspacePk, workspaceToken); - heimdall.niflheim(newWorkspacePk, newChangeSetId, true, false); + await heimdall.niflheim(newWorkspacePk, newChangeSetId, true, false); } }, ); +const EVENTUALLY_CONSISTENT_TIME = 30 * 1000; // 30 seconds +let indexInterval: NodeJS.Timeout; + +watch( + () => [props.changeSetId], + () => { + // clear any interval for other change set + if (indexInterval) clearInterval(indexInterval); + + // set a new interval (note: above watcher fires first cold start from the user selection change) + indexInterval = setInterval(() => { + heimdall.syncAtoms(props.workspacePk, props.changeSetId); + }, EVENTUALLY_CONSISTENT_TIME); + }, + { immediate: true }, +); + +watch( + () => heimdall.indexTouches.get(props.changeSetId), + () => { + if (lobby.value) return; // dont do anything when in the lobby + // each time we get index updates, clear the interval + if (indexInterval) clearInterval(indexInterval); + // and restart it + indexInterval = setInterval(() => { + heimdall.syncAtoms(props.workspacePk, props.changeSetId); + }, EVENTUALLY_CONSISTENT_TIME); + }, + { immediate: true }, +); + const indexFailedToLoad = computed(() => { // NOTE: this represents a 5XX error that was retried 5 times // if we get here its likely because the index could not be retrieved, or even built diff --git a/app/web/src/newhotness/nav/NavbarPanelCenter.vue b/app/web/src/newhotness/nav/NavbarPanelCenter.vue index 41474aa339..d7a3a363c3 100644 --- a/app/web/src/newhotness/nav/NavbarPanelCenter.vue +++ b/app/web/src/newhotness/nav/NavbarPanelCenter.vue @@ -2,7 +2,7 @@
-