Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
@@ -3,7 +3,6 @@
|
||||
// WebTracerProvider first installs that provider so the two stacks share
|
||||
// the trace_id. No-op when VITE_OTEL_EXPORTER_OTLP_ENDPOINT is unset.
|
||||
const publicEnv = ((import.meta as unknown as { env?: Record<string, string | undefined> }).env ?? {}) as Record<string, string | undefined>;
|
||||
const OBSERVABILITY_HYDRATION_GRACE_MS = 250;
|
||||
|
||||
function hasRuntimeSentryDsn() {
|
||||
return typeof globalThis !== "undefined" && typeof (globalThis as { __SENTRY_WEB_DSN__?: unknown }).__SENTRY_WEB_DSN__ === "string";
|
||||
@@ -22,33 +21,14 @@ async function initClientObservability() {
|
||||
// Core Web Vitals → Sentry (#70). Fire-and-forget; the helper is SSR-safe
|
||||
// and silently no-ops when Sentry/web-vitals aren't available. Keep it out
|
||||
// of observabilityReady so hydration never waits for the web-vitals chunk.
|
||||
void import("./lib/observability/web-vitals")
|
||||
.then(({ reportWebVitals }) => reportWebVitals())
|
||||
.catch(() => {});
|
||||
void import("./lib/observability/web-vitals").then(({ reportWebVitals }) => reportWebVitals()).catch(() => {});
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize configured observability before hydration so Sentry can install
|
||||
// global error/unhandledrejection handlers before React mounts. Builds without
|
||||
// client observability config avoid loading the heavy SDK chunks on startup.
|
||||
const observabilityReady = initClientObservability().catch(() => {
|
||||
// Observability must never block hydration. The individual modules keep
|
||||
// their own no-op behavior, and a failed dynamic import should degrade to
|
||||
// the browser/React defaults instead of blanking the app.
|
||||
});
|
||||
|
||||
function waitForObservabilityHydrationGrace(): Promise<void> {
|
||||
let timeoutId: number | undefined;
|
||||
const timeout = new Promise<void>((resolve) => {
|
||||
timeoutId = window.setTimeout(resolve, OBSERVABILITY_HYDRATION_GRACE_MS);
|
||||
});
|
||||
|
||||
return Promise.race([observabilityReady, timeout]).finally(() => {
|
||||
if (timeoutId !== undefined) {
|
||||
window.clearTimeout(timeoutId);
|
||||
}
|
||||
});
|
||||
}
|
||||
// Start configured observability immediately, but keep it off hydration's
|
||||
// critical path. A failed SDK import must degrade to browser/React defaults
|
||||
// instead of delaying or blanking the app.
|
||||
void initClientObservability().catch(() => {});
|
||||
|
||||
import { HydratedRouter } from "react-router/dom";
|
||||
import { StrictMode } from "react";
|
||||
@@ -64,8 +44,9 @@ import Backend from "i18next-http-backend";
|
||||
import LanguageDetector from "i18next-browser-languagedetector";
|
||||
import { formalLngs, i18nConfig } from "./locale/i18n.js";
|
||||
|
||||
async function hydrate() {
|
||||
await waitForObservabilityHydrationGrace();
|
||||
function hydrate() {
|
||||
const localeAssetVersion = publicEnv.VITE_APP_REVISION || publicEnv.VITE_SENTRY_RELEASE;
|
||||
const localeLoadPath = localeAssetVersion ? `/locales/{{lng}}/{{ns}}.json?v=${encodeURIComponent(localeAssetVersion)}` : "/locales/{{lng}}/{{ns}}.json";
|
||||
|
||||
i18next
|
||||
// Use the react-i18next plugin.
|
||||
@@ -89,8 +70,7 @@ async function hydrate() {
|
||||
// and pass them here to load the translations.
|
||||
ns: getInitialNamespaces(),
|
||||
backend: {
|
||||
requestOptions: { cache: "no-store" },
|
||||
loadPath: "/locales/{{lng}}/{{ns}}.json",
|
||||
loadPath: localeLoadPath,
|
||||
},
|
||||
detection: {
|
||||
// We'll detect the language only server-side with remix-i18next.
|
||||
@@ -121,10 +101,4 @@ async function hydrate() {
|
||||
});
|
||||
}
|
||||
|
||||
if (window.requestIdleCallback) {
|
||||
window.requestIdleCallback(hydrate);
|
||||
} else {
|
||||
// Safari doesn't support requestIdleCallback
|
||||
// https://caniuse.com/requestidlecallback
|
||||
window.setTimeout(hydrate, 1);
|
||||
}
|
||||
hydrate();
|
||||
Reference in new issue
Block a user