Skip to content

Commit

Permalink
fix: restore state works in react router
Browse files Browse the repository at this point in the history
Fixes #1076
  • Loading branch information
petyosi committed Apr 21, 2024
1 parent 461a5c9 commit bbc0967
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions examples/state.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ export function Example() {
const state = React.useRef<StateSnapshot | undefined>(undefined)
const [key, setKey] = React.useState(0)

console.log('Rendering with key', key)
return (
<div>
<button
Expand All @@ -17,8 +16,9 @@ export function Example() {
setKey((value) => value + 1)
}}
>
Log State
Save state and reload
</button>
<button onClick={() => setKey((value) => value + 1)}>Reload</button>

<Virtuoso
key={key}
Expand Down
2 changes: 1 addition & 1 deletion src/initialTopMostItemIndexSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const initialTopMostItemIndexSystem = u.system(
u.publish(initialItemFinalLocationReached, true)
})

skipFrames(3, () => {
skipFrames(4, () => {
u.handleNext(scrollTop, () => {
u.publish(scrolledToInitialItem, true)
})
Expand Down

0 comments on commit bbc0967

Please sign in to comment.