Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove redundant slash in path #42465

Merged
merged 1 commit into from
Jun 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion patches/@react-navigation+native+6.1.12.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/node_modules/@react-navigation/native/lib/module/createMemoryHistory.js b/node_modules/@react-navigation/native/lib/module/createMemoryHistory.js
index 16fdbef..bc2c96a 100644
index 16fdbef..e660dd6 100644
--- a/node_modules/@react-navigation/native/lib/module/createMemoryHistory.js
+++ b/node_modules/@react-navigation/native/lib/module/createMemoryHistory.js
@@ -1,8 +1,23 @@
Expand Down Expand Up @@ -63,6 +63,15 @@ index 16fdbef..bc2c96a 100644
replace(_ref3) {
var _window$history$state2;
let {
@@ -80,7 +101,7 @@ export default function createMemoryHistory() {

// Need to keep the hash part of the path if there was no previous history entry
// or the previous history entry had the same path
- let pathWithHash = path;
+ let pathWithHash = path.replace(/(\/{2,})|(\/$)/g, (match, p1) => (p1 ? '/' : ''));
if (!items.length || items.findIndex(item => item.id === id) < 0) {
// There are two scenarios for creating an array with only one history record:
// - When loaded id not found in the items array, this function by default will replace
@@ -108,7 +129,9 @@ export default function createMemoryHistory() {
window.history.replaceState({
id
Expand Down
Loading