Skip to content

Commit

Permalink
refactor(travels): refactor cachedTravels
Browse files Browse the repository at this point in the history
  • Loading branch information
unadlib committed Mar 23, 2024
1 parent efaaaf8 commit 44cd05c
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,18 +249,12 @@ export const useTravel = <S, F extends boolean, A extends boolean>(
state as object,
back
? _allPatches.inversePatches
.slice(
_allPatches.inversePatches.length - maxHistory,
_allPatches.inversePatches.length
)
.slice(-maxHistory)
.slice(nextPosition)
.flat()
.reverse()
: _allPatches.patches
.slice(
_allPatches.inversePatches.length - maxHistory,
_allPatches.inversePatches.length
)
.slice(-maxHistory)
.slice(position, nextPosition)
.flat()
) as S
Expand Down

0 comments on commit 44cd05c

Please sign in to comment.