Guard skip-agent against loading on /docs routes

cgen-7927c68f94774975911966b96a133f39
This commit is contained in:
Builder.io 2025-10-14 01:54:45 +00:00
parent 2cf5ce8a40
commit 536631b9a3

View file

@ -213,11 +213,24 @@ const createSkipAgentTheme = () => {
document.head.appendChild(style);
};
const isDocsPath = () => {
try {
return typeof window !== "undefined" && window.location.pathname.startsWith("/docs");
} catch (e) {
return false;
}
};
const isSkipAgentReachable = async (): Promise<boolean> => {
if (!shouldEnableSkipAgent) {
return false;
}
if (isDocsPath()) {
// Never check or initialize the agent from documentation routes.
return false;
}
const controller = new AbortController();
const timeout = window.setTimeout(() => controller.abort(), 4000);