Skip to content

Commit 80d5844

Browse files
authored
fix: fix encoding/matching issues with special chars (#9477)
* fix: fix encoding/matching issues with special chars * add changeset * Bump bundle
1 parent 8f684eb commit 80d5844

File tree

6 files changed

+759
-4
lines changed

6 files changed

+759
-4
lines changed

.changeset/hot-badgers-grow.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"react-router-dom": patch
3+
"@remix-run/router": patch
4+
---
5+
6+
fix encoding/matching issues with special chars

packages/react-router-dom/__tests__/navigate-encode-params-test.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
describe("navigate with params", () => {
1313
let node: HTMLDivElement;
1414
beforeEach(() => {
15+
global.history.pushState({}, "", "/");
1516
node = document.createElement("div");
1617
document.body.appendChild(node);
1718
});
@@ -88,7 +89,8 @@ describe("navigate with params", () => {
8889
let pathname = window.location.pathname.replace(/%20/g, "+");
8990
expect(pathname).toEqual("/blog/react+router");
9091

91-
expect(node.innerHTML).toMatch(/react router/);
92+
// Note decodeURIComponent doesn't decode +
93+
expect(node.innerHTML).toMatch(/react\+router/);
9294
});
9395
});
9496
});

0 commit comments

Comments
 (0)