Guard skip-agent against loading on /docs routes
cgen-7927c68f94774975911966b96a133f39
This commit is contained in:
parent
2cf5ce8a40
commit
536631b9a3
1 changed files with 13 additions and 0 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue