diff --git a/apps/builder/app/root.tsx b/apps/builder/app/root.tsx index be290602a4d1..96c635cddfba 100644 --- a/apps/builder/app/root.tsx +++ b/apps/builder/app/root.tsx @@ -1,5 +1,10 @@ // Our root outlet doesn't contain a layout because we have 2 types of documents: canvas and builder and we need to decide down the line which one to render, thre is no single root document. -import { Outlet, json, useLoaderData } from "@remix-run/react"; +import { + Outlet, + json, + useLoaderData, + type ShouldRevalidateFunction, +} from "@remix-run/react"; import { setEnv } from "@webstudio-is/feature-flags"; import env from "./env/env.server"; import { useSetFeatures } from "./shared/use-set-features"; @@ -17,3 +22,7 @@ export default function App() { return ; } + +export const shouldRevalidate: ShouldRevalidateFunction = () => { + return false; +}; diff --git a/apps/builder/app/routes/_ui.tsx b/apps/builder/app/routes/_ui.tsx index 26dbc5987888..5f3b6c725119 100644 --- a/apps/builder/app/routes/_ui.tsx +++ b/apps/builder/app/routes/_ui.tsx @@ -5,6 +5,7 @@ import { Scripts, ScrollRestoration, type ClientLoaderFunctionArgs, + type ShouldRevalidateFunction, } from "@remix-run/react"; import interFont from "@fontsource-variable/inter/index.css?url"; import manropeVariableFont from "@fontsource-variable/manrope/index.css?url"; @@ -106,3 +107,7 @@ export default function Layout() { ); } + +export const shouldRevalidate: ShouldRevalidateFunction = () => { + return false; +}; diff --git a/apps/builder/app/shared/nano-states/props.ts b/apps/builder/app/shared/nano-states/props.ts index 2eab2b5e35e6..52997cf3c1a7 100644 --- a/apps/builder/app/shared/nano-states/props.ts +++ b/apps/builder/app/shared/nano-states/props.ts @@ -718,7 +718,12 @@ export const subscribeResources = () => { cacheByKeys.set(cacheKey, undefined); } - const result = await loadResources(Array.from(missing.values())); + const missingValues = Array.from(missing.values()); + if (missingValues.length === 0) { + return; + } + + const result = await loadResources(missingValues); const newResourceValues = new Map(); for (const request of computedResources) { const cacheKey = JSON.stringify(request);