rm unused sentienal
This commit is contained in:
@@ -241,14 +241,10 @@ export function MessagesList({
|
|||||||
itemCount: convoState.items.length,
|
itemCount: convoState.items.length,
|
||||||
isFetchingHistory: convoState.isFetchingHistory,
|
isFetchingHistory: convoState.isFetchingHistory,
|
||||||
})
|
})
|
||||||
// If history is already done loading, mark ready after a frame for the scroll to settle.
|
requestAnimationFrame(() => {
|
||||||
// Otherwise, the footer sentinel's onLayout will handle it when history finishes.
|
logger.debug('setHasScrolled(true) via onContentSizeChange')
|
||||||
if (!convoState.isFetchingHistory) {
|
setHasScrolled(true)
|
||||||
requestAnimationFrame(() => {
|
})
|
||||||
logger.debug('setHasScrolled(true) via onContentSizeChange')
|
|
||||||
setHasScrolled(true)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
prevContentHeight.current = height
|
prevContentHeight.current = height
|
||||||
prevItemCount.current = renderItems.length
|
prevItemCount.current = renderItems.length
|
||||||
return
|
return
|
||||||
@@ -289,7 +285,6 @@ export function MessagesList({
|
|||||||
[
|
[
|
||||||
hasScrolled,
|
hasScrolled,
|
||||||
setHasScrolled,
|
setHasScrolled,
|
||||||
convoState.isFetchingHistory,
|
|
||||||
renderItems.length,
|
renderItems.length,
|
||||||
// these are stable
|
// these are stable
|
||||||
flatListRef,
|
flatListRef,
|
||||||
@@ -459,26 +454,6 @@ export function MessagesList({
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
// Footer sentinel: when history is still loading during the initial scroll, the footer's onLayout fires each time
|
|
||||||
// new items are prepended (shifting its position). Once history finishes, this triggers setHasScrolled.
|
|
||||||
const onFooterLayout = useCallback(() => {
|
|
||||||
logger.debug('onFooterLayout', {
|
|
||||||
hasInitiallyScrolled: hasInitiallyScrolled.current,
|
|
||||||
hasScrolled,
|
|
||||||
isFetchingHistory: convoState.isFetchingHistory,
|
|
||||||
})
|
|
||||||
if (
|
|
||||||
hasInitiallyScrolled.current &&
|
|
||||||
!hasScrolled &&
|
|
||||||
!convoState.isFetchingHistory
|
|
||||||
) {
|
|
||||||
requestAnimationFrame(() => {
|
|
||||||
logger.debug('setHasScrolled(true) via onFooterLayout')
|
|
||||||
setHasScrolled(true)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}, [hasScrolled, setHasScrolled, convoState.isFetchingHistory])
|
|
||||||
|
|
||||||
const renderScrollComponent = useCallback(
|
const renderScrollComponent = useCallback(
|
||||||
(props: ScrollViewProps) => (
|
(props: ScrollViewProps) => (
|
||||||
<ChatScrollComponent {...props} inputHeight={inputHeightUI} />
|
<ChatScrollComponent {...props} inputHeight={inputHeightUI} />
|
||||||
@@ -539,10 +514,7 @@ export function MessagesList({
|
|||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
ListFooterComponent={
|
ListFooterComponent={
|
||||||
<View
|
<View style={web({height: tokens.space.md + inputHeightJS})} />
|
||||||
style={web({height: tokens.space.md + inputHeightJS})}
|
|
||||||
onLayout={onFooterLayout}
|
|
||||||
/>
|
|
||||||
}
|
}
|
||||||
style={web({
|
style={web({
|
||||||
scrollbarWidth: 'thin',
|
scrollbarWidth: 'thin',
|
||||||
|
|||||||
Reference in New Issue
Block a user