fix(chat): allow loadOlder without containerRef (mc#2908 F9) #3035
Reference in New Issue
Block a user
Delete Branch "fix/mobile-chat-f9-loadolder-without-container"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes F9 from mobile-chat audit #2908.
useChatHistory.loadOlderreturned early whencontainerRef.currentwas absent, silently dropping older-history requests. This PR makes scroll anchoring conditional: when a container is available the anchor is set as before, but when it is not the hook still fetches and prepends older messages.Validation
npm run buildincanvas/passes.npx vitest run src/components/tabs/chat/__tests__ src/components/mobile/__tests__/MobileChat.test.tsxpasses (341/341).Relates-to: #2908
APPROVED after independent 5-axis review.
Correctness:
loadOlderno longer silently no-ops whencontainerRefis absent; it still loads older history and only skips scroll anchoring when no container is available. Robustness: inflight/token/hasMore behavior remains unchanged. Security/performance: no meaningful risk. Readability: the optional-anchor branch is clear and localized.APPROVED. 5-axis review on head
2a0306f6.Correctness:
loadOlderno longer returns early solely becausecontainerRef.currentis absent; it still fetches and prepends older messages, while preserving scroll-anchor behavior when a container exists. That directly fixes the mobile/no-container path from mc#2908 F9.Robustness/security/performance: no new trust boundary or auth surface; inflight/token handling and pagination semantics remain unchanged. When no container exists, scroll anchoring is explicitly disabled rather than stale. Readability is straightforward. CI / all-required is green.