Comment formatting

This commit is contained in:
Eric Bailey
2025-09-30 10:36:47 -05:00
parent fef6b968c1
commit 7bd25047d2
+10 -8
View File
@@ -148,7 +148,9 @@ export function PostThread({uri}: {uri: string}) {
*/ */
const shouldHandleScroll = useRef(true) const shouldHandleScroll = useRef(true)
/** /**
* Called any time the content size of the list changes, _just_ before paint. * Called any time the content size of the list changes. Could be a fresh
* render, items being added to the list, or any resize that changes the
* scrollable size of the content.
* *
* We want this to fire every time we change params (which will reset * We want this to fire every time we change params (which will reset
* `deferParents` via `onLayout` on the anchor post, due to the key change), * `deferParents` via `onLayout` on the anchor post, due to the key change),
@@ -197,17 +199,17 @@ export function PostThread({uri}: {uri: string}) {
list.scrollToOffset({offset}) list.scrollToOffset({offset})
/* /*
* After we manage to do a positive adjustment, we need * After we manage to do a positive adjustment, we need to ensure this
* to ensure this doesn't run again until scroll handling is requested * doesn't run again until scroll handling is requested again via
* again via `shouldHandleScroll.current === true` and a params * `shouldHandleScroll.current === true` and a params change via
* change via `prepareForParamsUpdate`. * `prepareForParamsUpdate`.
* *
* The `isRoot` here is needed because if we're looking at the anchor * The `isRoot` here is needed because if we're looking at the anchor
* post, this handler will not fire after `deferParents` is set to * post, this handler will not fire after `deferParents` is set to
* `false`, since there are no parents to render above it. In this case, * `false`, since there are no parents to render above it. In this case,
* we want to make sure `shouldHandleScroll` is set to `false` so that * we want to make sure `shouldHandleScroll` is set to `false` right away
* subsequent size changes unrelated to a params change (like pagination) * so that subsequent size changes unrelated to a params change (like
* do not affect scroll. * pagination) do not affect scroll.
*/ */
if (offset > 0 || isRoot) shouldHandleScroll.current = false if (offset > 0 || isRoot) shouldHandleScroll.current = false
} }