mirror of
https://github.com/ajvpot/meshexplorer.git
synced 2026-07-06 01:30:58 +02:00
actually actually fix chat
This commit is contained in:
@@ -75,10 +75,11 @@ export default function ChatBox({ showAllMessagesTab = false, className = "", st
|
||||
const res = await fetch(buildApiUrl(url));
|
||||
const data = await res.json();
|
||||
if (Array.isArray(data)) {
|
||||
if (after && data.length > 0) {
|
||||
if (after) {
|
||||
// Add newer messages to the beginning (most recent first)
|
||||
setMessages((prev) => [...data, ...prev]);
|
||||
// Don't update hasMore or lastBefore for auto-refresh
|
||||
if (data.length > 0) {
|
||||
setMessages((prev) => [...data, ...prev]);
|
||||
}
|
||||
} else {
|
||||
setMessages((prev) => replace ? data : [...prev, ...data]);
|
||||
setHasMore(data.length === PAGE_SIZE);
|
||||
|
||||
Reference in New Issue
Block a user