Skip to content

Commit 7bcecb3

Browse files
fix: router injection guard was matching __stxRouterConfig as false positive
The guard `template.includes('__stxRouter')` was matching the layout's `window.__stxRouterConfig` variable, thinking the router was already injected. Changed to check for the router's actual guard signature (`__stxRouter)return` or `__stxRouter=true`) instead of a substring. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 4c0c593 commit 7bcecb3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/stx/src/process.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -672,8 +672,8 @@ export function injectRouterScript(template: string): string {
672672
return template
673673
}
674674

675-
// Don't inject if already present
676-
if (template.includes('__stxRouter')) {
675+
// Don't inject if already present (check for the router's own guard, not config references)
676+
if (template.includes('__stxRouter)return') || template.includes('__stxRouter=true')) {
677677
return template
678678
}
679679

0 commit comments

Comments
 (0)