diff --git a/apps/hub/src/app.tsx b/apps/hub/src/app.tsx index 56940b67..45306b16 100644 --- a/apps/hub/src/app.tsx +++ b/apps/hub/src/app.tsx @@ -49,11 +49,11 @@ function InnerApp() { return ; } -export function App() { +export function App({ cacheKey }: { cacheKey?: string }) { return ( diff --git a/apps/hub/src/main.tsx b/apps/hub/src/main.tsx index 4ffbd7f9..c702cd97 100644 --- a/apps/hub/src/main.tsx +++ b/apps/hub/src/main.tsx @@ -3,16 +3,29 @@ import ReactDOM from "react-dom/client"; import { App } from "./app"; import "./index.css"; import { initThirdPartyProviders } from "./components/third-party-providers"; +import { rivetClient } from "./queries/global"; initThirdPartyProviders(); -// biome-ignore lint/style/noNonNullAssertion: it should always be present -const rootElement = document.getElementById("root")!; -if (!rootElement.innerHTML) { - const root = ReactDOM.createRoot(rootElement); - root.render( - - - , - ); +rivetClient.cloud + .bootstrap() + .then((response) => { + // @ts-ignore + run({ cacheKey: response.deploy_hash }); + }) + .catch(() => { + run(); + }); + +function run({ cacheKey }: { cacheKey?: string } = {}) { + // biome-ignore lint/style/noNonNullAssertion: it should always be present + const rootElement = document.getElementById("root")!; + if (!rootElement.innerHTML) { + const root = ReactDOM.createRoot(rootElement); + root.render( + + + , + ); + } }