@poolse/react 3.5.0 → 3.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,18 @@ All notable changes to `@poolse/react` are documented here. Format follows
4
4
  [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versions follow
5
5
  [semver](https://semver.org).
6
6
 
7
+ ## [3.6.1] - 2026-11-21
8
+
9
+ - No changes; released with the other `@poolse/*` packages at 3.6.1.
10
+
11
+ ## [3.6.0] - 2026-11-21
12
+
13
+ ### Fixed
14
+
15
+ - `useMessages().loadMore()` no longer inserts a page twice when it overlaps
16
+ another `loadMore()` or `loadUntil()` (e.g. scrolling up while jumping to
17
+ the first unread).
18
+
7
19
  ## [3.5.0] - 2026-11-21
8
20
 
9
21
  ### Added
package/dist/index.cjs CHANGED
@@ -620,9 +620,15 @@ function useMessages(conversationId) {
620
620
  return;
621
621
  }
622
622
  const older = [...page.data].reverse();
623
- setMessages((prev) => [...older, ...prev]);
623
+ setMessages((prev) => {
624
+ const have = new Set(prev.map((m) => m.id));
625
+ return [...older.filter((m) => !have.has(m.id)), ...prev];
626
+ });
624
627
  setHasMore(page.data.length === PAGE_SIZE);
625
- oldestSequenceRef.current = older[0]?.sequence ?? oldestSequenceRef.current;
628
+ const first = older[0]?.sequence;
629
+ const current = oldestSequenceRef.current;
630
+ if (first != null)
631
+ oldestSequenceRef.current = current == null ? first : Math.min(current, first);
626
632
  }, [chat, conversationId, hasMore, loading]);
627
633
  const loadUntil = react.useCallback(
628
634
  async (messageId, maxPages = 20) => {