Skip to content

Commit

Permalink
fix: react extract incorrect resource from encoded pathname (#3126)
Browse files Browse the repository at this point in the history
* fix: react extract incorrect resource from encoded pathname

* fix: update changeset

* fix: lint
  • Loading branch information
thaihuynhxyz committed Dec 5, 2022
1 parent 365c3ed commit ccaf8bd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
6 changes: 6 additions & 0 deletions .changeset/warm-peas-report.md
@@ -0,0 +1,6 @@
---
"@pankod/refine-react-location": patch
"@pankod/refine-react-router-v6": patch
---

fix: react extract incorrect resource from encoded pathname
6 changes: 3 additions & 3 deletions packages/react-location/src/index.ts
Expand Up @@ -68,9 +68,9 @@ const RouterProvider: IReactRouterProvider = {
resource:
Object.keys(match.params).length === 0
? pathname.current.pathname.substring(1)
: pathname.current.pathname
.substring(1)
.replace(paramsString, ""),
: decodeURIComponent(
pathname.current.pathname.substring(1),
).replace(paramsString, ""),
});
},
Prompt,
Expand Down
5 changes: 4 additions & 1 deletion packages/react-router-v6/src/index.ts
Expand Up @@ -54,7 +54,10 @@ const RouterProvider: IReactRouterProvider = {
resource:
Object.keys(params).length === 0
? pathname.substring(1)
: pathname.substring(1).replace(paramsString, ""),
: decodeURIComponent(pathname.substring(1)).replace(
paramsString,
"",
),
});
},
Prompt: Prompt as any,
Expand Down

0 comments on commit ccaf8bd

Please sign in to comment.