| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
… of falling back to window.location.search hasAuthParams(url, afterSignInUrl) accepted a URL argument but called hasAuthParamsInUrl() with no argument, silently ignoring url.search and always checking window.location.search instead. This makes the helpers untestable in isolation and incorrect whenever the provided URL differs from the current window location. Fix all call sites to pass url.search explicitly. Also correct the JSDoc on hasAuthParamsInUrl: the function only checks for 'code', not both 'code' and 'session_state' as the old description claimed.
There was a problem hiding this comment.
Fixes browser auth-param detection to use the caller-provided URL consistently (instead of implicitly reading window.location.search), improving correctness in non-window scenarios (tests, navigation, SSR hydration) and aligning documentation with actual behavior.
Changes:
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/vue/src/providers/ThunderIDProvider.ts | Passes url.search to hasAuthParamsInUrl to ensure correct URL evaluation. |
| packages/react/src/hooks/useBrowserUrl.ts | Passes url.search to hasAuthParamsInUrl to avoid falling back to window.location.search. |
| packages/browser/src/utils/hasAuthParamsInUrl.ts | Updates JSDoc to match the function’s actual detection logic (code). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sorry, something went wrong.
…wserUrl - Clarify hasAuthParamsInUrl @PARAM docs: function expects a raw URL.search string (with leading ? or &), not a URLSearchParams.toString() result - Support relative afterSignInUrl in hasAuthParams by resolving against url.origin via new URL(afterSignInUrl, url.origin) - Update JSDoc example to note both absolute and relative forms are accepted
| Back | FazBrowse Home | New Git URL |
Purpose
hasAuthParams(url, afterSignInUrl) accepts a URL argument but both the React hook (useBrowserUrl) and the Vue provider (ThunderIDProvider) called hasAuthParamsInUrl() with no argument, silently ignoring url.search and always falling back to window.location.search.
This makes the helpers untestable in isolation (you cannot pass an arbitrary URL) and would produce incorrect results in any scenario where the caller's url differs from the current window location (e.g. during navigation events, SSR hydration, or unit tests).
Also fixes a JSDoc mismatch on hasAuthParamsInUrl: the description claimed it checks for both code and session_state, but the implementation only checks for code.
Approach
No behaviour change in production (both callers already pass the current window URL), but the helpers are now correct by construction and fully testable.
Related Issues