Skip to content

Commit 13b77dc

Browse files
authored
fix: dead loop in strict mode (#240)
1 parent baf7527 commit 13b77dc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/hooks/useScrollTo.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,12 @@ export default function useScrollTo<T>(
135135

136136
// Trigger next effect
137137
if (needCollectHeight) {
138-
setSyncState((ori) => ({
139-
...ori,
140-
times: ori.times + 1,
138+
setSyncState({
139+
...syncState,
140+
times: syncState.times + 1,
141141
targetAlign: newTargetAlign,
142142
lastTop: targetTop,
143-
}));
143+
});
144144
}
145145
} else if (process.env.NODE_ENV !== 'production' && syncState?.times === MAX_TIMES) {
146146
warning(

0 commit comments

Comments
 (0)