Fix unexpected history back navigations (#1424)
This commit is contained in:
parent
b5542462ac
commit
4082143e10
@ -124,6 +124,7 @@ export default function useHistoryBack(
|
|||||||
} else {
|
} else {
|
||||||
const prev = prevHashes || [];
|
const prev = prevHashes || [];
|
||||||
if (prev.length < hashes.length) {
|
if (prev.length < hashes.length) {
|
||||||
|
setTimeout(() => {
|
||||||
const index = ++historyState.currentIndex;
|
const index = ++historyState.currentIndex;
|
||||||
historyState.currentIndexes.push(index);
|
historyState.currentIndexes.push(index);
|
||||||
|
|
||||||
@ -136,6 +137,7 @@ export default function useHistoryBack(
|
|||||||
index,
|
index,
|
||||||
hash: hashes[hashes.length - 1],
|
hash: hashes[hashes.length - 1],
|
||||||
});
|
});
|
||||||
|
}, 0);
|
||||||
} else {
|
} else {
|
||||||
const delta = prev.length - hashes.length;
|
const delta = prev.length - hashes.length;
|
||||||
if (isHashChangedFromEvent.current) {
|
if (isHashChangedFromEvent.current) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user