Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

fix: Rate limit on shared link clicks (#4715)

Ivan Starkov069376f8e9e8
diff --git a/apps/builder/app/root.tsx b/apps/builder/app/root.tsx
index be290602a4..96c635cddf 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 <Outlet />;
}
+
+export const shouldRevalidate: ShouldRevalidateFunction = () => {
+ return false;
+};
diff --git a/apps/builder/app/routes/_ui.tsx b/apps/builder/app/routes/_ui.tsx
index 26dbc59878..5f3b6c7251 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() {
</Document>
);
}
+
+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 2eab2b5e35..52997cf3c1 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);