Skip to content

Commit af6508b

Browse files
authored
fix(url): handle optional window.location in createUrl for react native (#3483)
fixes: #3445 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Improved runtime safety and reliability of URL handling to reduce errors in edge cases. No changes to public APIs or outward behavior; existing integrations remain compatible. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 7fdef5e commit af6508b

File tree

1 file changed

+2
-2
lines changed
  • packages/web/src/package/tools

1 file changed

+2
-2
lines changed

packages/web/src/package/tools/url.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ export function joinUrls(...parts: string[]): string {
1717

1818
export function createUrl(...parts: string[]): URL {
1919
const url = joinUrls(...parts);
20-
const base =
21-
typeof window === 'undefined' ? undefined : window.location.origin;
2220

2321
try {
22+
const base =
23+
typeof window === 'undefined' ? undefined : window.location.origin;
2424
return new URL(url, base);
2525
} catch {
2626
// there might be a weird value in `base`

0 commit comments

Comments
 (0)