Skip to content

Open source CapCut alternative.

TypeScript

fix(site): settings pages render outside the connect wall

David Le02ec5536f66a
diff --git a/site/src/cut/components/ConnectGate.tsx b/site/src/cut/components/ConnectGate.tsx
index 2a6d7d54..dfd0bd84 100644
--- a/site/src/cut/components/ConnectGate.tsx
+++ b/site/src/cut/components/ConnectGate.tsx
@@ -1,6 +1,7 @@
"use client";
import Image from "next/image";
+import { usePathname } from "next/navigation";
import { useCallback, useEffect, useState, type ReactNode } from "react";
import { Loader2, Plug, ShieldX } from "lucide-react";
@@ -65,6 +66,10 @@ async function permissionState(): Promise<PermissionState | null> {
}
export function ConnectGate({ children }: { children: ReactNode }) {
+ // Settings pages (billing, usage, feature flags) never touch the engine, so
+ // they render ungated — walling them would block the very page that turns
+ // cloud mode on.
+ const onSettings = (usePathname() ?? "").split("/").includes("settings");
const [gate, setGate] = useState<Gate>("checking");
// Whether starting a probe would raise the browser's permission prompt.
// True blocks all automatic probing and turns the modal into the connect
@@ -120,8 +125,9 @@ export function ConnectGate({ children }: { children: ReactNode }) {
}, [pass, passCloud]);
useEffect(() => {
+ if (onSettings) return;
void check();
- }, [check]);
+ }, [check, onSettings]);
// The flag flips on the fly from the account menu: turning it on releases a
// gated page into cloud mode via a fresh check; turning it off while running
@@ -185,6 +191,8 @@ export function ConnectGate({ children }: { children: ReactNode }) {
setGate("install");
};
+ if (onSettings) return <>{children}</>;
+
const gated = gate !== "pass";
const connecting = gate === "connecting";