Skip to content

Commit 890aefb

Browse files
committed
Fix embed branding to skip API call when explicitly enabled
1 parent 6fd19a1 commit 890aefb

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

apps/web/src/components/embed/useEmbedBranding.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ export function useEmbedBranding(website: string, token: string, explicitBrandin
44
const [showBranding, setShowBranding] = useState(explicitBranding);
55

66
useEffect(() => {
7+
// branding=1 is explicit — no need to check the API
8+
if (explicitBranding) return;
9+
710
if (!website || !token) {
811
setShowBranding(false);
912
return;
@@ -14,10 +17,10 @@ export function useEmbedBranding(website: string, token: string, explicitBrandin
1417
fetch(`/api/embed/meta?website=${encodeURIComponent(website)}&token=${encodeURIComponent(token)}`)
1518
.then((res) => (res.ok ? res.json() : null))
1619
.then((data: { branding?: boolean } | null) => {
17-
if (!cancelled) setShowBranding(Boolean(data?.branding) || explicitBranding);
20+
if (!cancelled) setShowBranding(Boolean(data?.branding));
1821
})
1922
.catch(() => {
20-
if (!cancelled) setShowBranding(explicitBranding);
23+
if (!cancelled) setShowBranding(false);
2124
});
2225

2326
return () => {

0 commit comments

Comments
 (0)