Skip to content

Commit

Permalink
fix: fix history key list
Browse files Browse the repository at this point in the history
  • Loading branch information
qiqiboy committed May 17, 2022
1 parent 9cc998f commit e78327e
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions dist/react-animated-router.cjs.development.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,14 +250,14 @@ var isHistoryPush = function isHistoryPush(location, navigationType, update) {
var isPush = true; // REPLACE: replace the end key

if (navigationType === reactRouter.NavigationType.Replace) {
histories.splice(-1, 1, key);
histories.splice(lastIndex, 1, key);
} else if (navigationType === reactRouter.NavigationType.Push) {
// PUSH: remove from the last key pos, add new key to the end
lastIndex > -1 && histories.splice(lastIndex + 1);
histories.push(key);
} else {
var index = histories.lastIndexOf(key);
isPush = lastIndex < index;
var newIndex = histories.lastIndexOf(key);
isPush = lastIndex < newIndex;
}

sessionStorage.setItem(REACT_HISTORIES_KEY, histories.join(','));
Expand Down
2 changes: 1 addition & 1 deletion dist/react-animated-router.cjs.production.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions dist/react-animated-router.esm.development.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,14 @@ var isHistoryPush = function isHistoryPush(location, navigationType, update) {
var isPush = true; // REPLACE: replace the end key

if (navigationType === NavigationType.Replace) {
histories.splice(-1, 1, key);
histories.splice(lastIndex, 1, key);
} else if (navigationType === NavigationType.Push) {
// PUSH: remove from the last key pos, add new key to the end
lastIndex > -1 && histories.splice(lastIndex + 1);
histories.push(key);
} else {
var index = histories.lastIndexOf(key);
isPush = lastIndex < index;
var newIndex = histories.lastIndexOf(key);
isPush = lastIndex < newIndex;
}

sessionStorage.setItem(REACT_HISTORIES_KEY, histories.join(','));
Expand Down
Loading

0 comments on commit e78327e

Please sign in to comment.