MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / useEnvironmentsWithHealth

Function useEnvironmentsWithHealth

console/src/store/environments.ts:406–422  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

404 * Throws a promise to trigger suspense if the data isn't available yet.
405 */
406export const useEnvironmentsWithHealth = () => {
407 const [environments] = useAtom(environmentsWithHealth);
408
409 if (environments) return environments;
410
411 throw new Promise<EnvironmentsWithHealth>((resolve) => {
412 const interval = setInterval(() => {
413 const envLoadable = getStore().get(loadableEnvironmentsWithHealth);
414 const map =
415 envLoadable.state === "hasData" ? envLoadable.data : undefined;
416 if (map) {
417 clearInterval(interval);
418 resolve(map);
419 }
420 }, 50);
421 });
422};
423
424const defaultTimeout = 10_000; // 10 seconds
425const maxBootDuration = { minutes: 15 };

Callers 7

WelcomeDialogContentFunction · 0.90
EnvironmentSelectFieldFunction · 0.90
EnvironmentRoutesFunction · 0.90
RedirectToHomeFunction · 0.90
OnboardingSurveyFunction · 0.90
EnableRegionContentFunction · 0.90

Calls 3

getStoreFunction · 0.90
resolveFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected