Skip to content

Commit e78327e

Browse files
author
qiqiboy
committed
fix: fix history key list
1 parent 9cc998f commit e78327e

6 files changed

+12
-12
lines changed

dist/react-animated-router.cjs.development.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,14 +250,14 @@ var isHistoryPush = function isHistoryPush(location, navigationType, update) {
250250
var isPush = true; // REPLACE: replace the end key
251251

252252
if (navigationType === reactRouter.NavigationType.Replace) {
253-
histories.splice(-1, 1, key);
253+
histories.splice(lastIndex, 1, key);
254254
} else if (navigationType === reactRouter.NavigationType.Push) {
255255
// PUSH: remove from the last key pos, add new key to the end
256256
lastIndex > -1 && histories.splice(lastIndex + 1);
257257
histories.push(key);
258258
} else {
259-
var index = histories.lastIndexOf(key);
260-
isPush = lastIndex < index;
259+
var newIndex = histories.lastIndexOf(key);
260+
isPush = lastIndex < newIndex;
261261
}
262262

263263
sessionStorage.setItem(REACT_HISTORIES_KEY, histories.join(','));

dist/react-animated-router.cjs.production.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/react-animated-router.esm.development.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,14 +159,14 @@ var isHistoryPush = function isHistoryPush(location, navigationType, update) {
159159
var isPush = true; // REPLACE: replace the end key
160160

161161
if (navigationType === NavigationType.Replace) {
162-
histories.splice(-1, 1, key);
162+
histories.splice(lastIndex, 1, key);
163163
} else if (navigationType === NavigationType.Push) {
164164
// PUSH: remove from the last key pos, add new key to the end
165165
lastIndex > -1 && histories.splice(lastIndex + 1);
166166
histories.push(key);
167167
} else {
168-
var index = histories.lastIndexOf(key);
169-
isPush = lastIndex < index;
168+
var newIndex = histories.lastIndexOf(key);
169+
isPush = lastIndex < newIndex;
170170
}
171171

172172
sessionStorage.setItem(REACT_HISTORIES_KEY, histories.join(','));

0 commit comments

Comments
 (0)