Skip to content

Commit 139d066

Browse files
committed
fix: Rate limit on shared link clicks
1 parent 85147c8 commit 139d066

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

apps/builder/app/root.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
// 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.
2-
import { Outlet, json, useLoaderData } from "@remix-run/react";
2+
import {
3+
Outlet,
4+
json,
5+
useLoaderData,
6+
type ShouldRevalidateFunction,
7+
} from "@remix-run/react";
38
import { setEnv } from "@webstudio-is/feature-flags";
49
import env from "./env/env.server";
510
import { useSetFeatures } from "./shared/use-set-features";
@@ -17,3 +22,7 @@ export default function App() {
1722

1823
return <Outlet />;
1924
}
25+
26+
export const shouldRevalidate: ShouldRevalidateFunction = () => {
27+
return false;
28+
};

apps/builder/app/routes/_ui.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
Scripts,
66
ScrollRestoration,
77
type ClientLoaderFunctionArgs,
8+
type ShouldRevalidateFunction,
89
} from "@remix-run/react";
910
import interFont from "@fontsource-variable/inter/index.css?url";
1011
import manropeVariableFont from "@fontsource-variable/manrope/index.css?url";
@@ -106,3 +107,7 @@ export default function Layout() {
106107
</Document>
107108
);
108109
}
110+
111+
export const shouldRevalidate: ShouldRevalidateFunction = () => {
112+
return false;
113+
};

apps/builder/app/shared/nano-states/props.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,11 @@ export const subscribeResources = () => {
718718
cacheByKeys.set(cacheKey, undefined);
719719
}
720720

721+
const missingValues = Array.from(missing.values());
722+
if (missingValues.length === 0) {
723+
return;
724+
}
725+
721726
const result = await loadResources(Array.from(missing.values()));
722727
const newResourceValues = new Map();
723728
for (const request of computedResources) {

0 commit comments

Comments
 (0)