Load complete chat history when reaching the top (#2481)

* fix(chat): load older timeline history consistently

Pagination depended on scroll events, so short or compacted initial pages could never request older history. Reevaluate edge visibility as layout and history change, and standardize loading indicators on the canonical app spinner.

* fix(chat): keep older history loading reliably

Use authoritative timeline cursor progress so merged rows cannot stall pagination. Wait for bottom anchoring before evaluating the history edge, and re-arm retries on a fresh upward gesture without automatic failure loops.
This commit is contained in:
Mohamed Boudra
2026-07-27 18:21:07 +08:00
committed by GitHub
parent 80c8a08393
commit b97d6d13f3
38 changed files with 609 additions and 177 deletions
+3 -2
View File
@@ -1,3 +1,4 @@
import { LoadingSpinner } from "@/components/ui/loading-spinner";
import {
default as React,
useCallback,
@@ -8,7 +9,7 @@ import {
type ReactElement,
type ReactNode,
} from "react";
import { ActivityIndicator, Pressable, Text, View } from "react-native";
import { Pressable, Text, View } from "react-native";
import type {
PressableProps,
PressableStateCallbackType,
@@ -44,7 +45,7 @@ function ButtonIcon({ loading, leftIcon, iconSize, iconColor }: ButtonIconProps)
if (loading) {
return (
<View>
<ActivityIndicator size="small" color={iconColor} />
<LoadingSpinner size="small" color={iconColor} />
</View>
);
}
@@ -1,3 +1,4 @@
import { LoadingSpinner } from "@/components/ui/loading-spinner";
import {
type ComponentProps,
createContext,
@@ -14,7 +15,6 @@ import {
} from "react";
import { useTranslation } from "react-i18next";
import {
ActivityIndicator,
Dimensions,
Modal,
Platform,
@@ -630,7 +630,7 @@ function resolveLeadingContent(input: {
successColor: string;
}): ReactElement | null {
if (input.isPending) {
return <ActivityIndicator size={16} color={input.pendingColor} />;
return <LoadingSpinner size={16} color={input.pendingColor} />;
}
if (input.isSuccess) {
return <CheckCircle size={16} color={input.successColor} />;
@@ -1,3 +1,4 @@
import { LoadingSpinner } from "@/components/ui/loading-spinner";
import {
createContext,
useCallback,
@@ -14,7 +15,6 @@ import {
import { createPortal } from "react-dom";
import { useTranslation } from "react-i18next";
import {
ActivityIndicator,
Modal,
Pressable,
Text,
@@ -717,7 +717,7 @@ function resolveDropdownItemLeadingContent(input: {
}): ReactElement | null {
const { isPending, isSuccess, leading, theme } = input;
if (isPending) {
return <ActivityIndicator size={16} color={theme.colors.foregroundMuted} />;
return <LoadingSpinner size={16} color={theme.colors.foregroundMuted} />;
}
if (isSuccess) {
return <CheckCircle size={16} color={theme.colors.palette.green[500]} />;
@@ -3,8 +3,9 @@ import { ActivityIndicator, type ActivityIndicatorProps } from "react-native";
interface LoadingSpinnerProps {
color: string;
size?: ActivityIndicatorProps["size"];
style?: ActivityIndicatorProps["style"];
}
export function LoadingSpinner({ color, size = "small" }: LoadingSpinnerProps) {
return <ActivityIndicator size={size} color={color} />;
export function LoadingSpinner({ color, size = "small", style }: LoadingSpinnerProps) {
return <ActivityIndicator size={size} color={color} style={style} />;
}