Skip to content

Commit

Permalink
fix(shared): Allow routers to access private members (#4197)
Browse files Browse the repository at this point in the history
  • Loading branch information
dstaley committed Sep 19, 2024
1 parent c209889 commit 6275c24
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/green-hairs-drive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@clerk/shared": patch
---

Fix issue where class-based routers were unable to access their private members during the `pathname` and `searchParams` methods.
12 changes: 10 additions & 2 deletions packages/shared/src/router/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,14 @@ export function createClerkRouter(router: ClerkHostRouter, basePath: string = '/
return router.shallowPush(destinationUrl);
}

function pathname() {
return router.pathname();
}

function searchParams() {
return router.searchParams();
}

return {
child,
match,
Expand All @@ -143,8 +151,8 @@ export function createClerkRouter(router: ClerkHostRouter, basePath: string = '/
push,
replace,
shallowPush,
pathname: router.pathname,
searchParams: router.searchParams,
pathname,
searchParams,
basePath: normalizedBasePath,
};
}

0 comments on commit 6275c24

Please sign in to comment.