[Web] Fix thread jumps

This commit is contained in:
Dan Abramov
2025-09-30 02:31:00 +01:00
parent 7f4e3091f7
commit fef6b968c1
+4 -5
View File
@@ -193,12 +193,11 @@ export function PostThread({uri}: {uri: string}) {
* will give us a _positive_ offset, which will scroll the anchor post * will give us a _positive_ offset, which will scroll the anchor post
* back _up_ to the top of the screen. * back _up_ to the top of the screen.
*/ */
list.scrollToOffset({ const offset = anchorOffsetTop - headerHeight
offset: anchorOffsetTop - headerHeight, list.scrollToOffset({offset})
})
/* /*
* After the second pass, `deferParents` will be `false`, and we need * After we manage to do a positive adjustment, we need
* to ensure this doesn't run again until scroll handling is requested * to ensure this doesn't run again until scroll handling is requested
* again via `shouldHandleScroll.current === true` and a params * again via `shouldHandleScroll.current === true` and a params
* change via `prepareForParamsUpdate`. * change via `prepareForParamsUpdate`.
@@ -210,7 +209,7 @@ export function PostThread({uri}: {uri: string}) {
* subsequent size changes unrelated to a params change (like pagination) * subsequent size changes unrelated to a params change (like pagination)
* do not affect scroll. * do not affect scroll.
*/ */
if (!deferParents || isRoot) shouldHandleScroll.current = false if (offset > 0 || isRoot) shouldHandleScroll.current = false
} }
}) })