@poolse/react 2.1.6 → 2.3.0
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 +149 -149
- package/LICENSE +21 -21
- package/README.md +335 -335
- package/dist/index.cjs +181 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +100 -2
- package/dist/index.d.ts +100 -2
- package/dist/index.js +180 -1
- package/dist/index.js.map +1 -1
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,149 +1,149 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
All notable changes to `@poolse/react` are documented here. Format follows
|
|
4
|
-
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versions follow
|
|
5
|
-
[semver](https://semver.org).
|
|
6
|
-
|
|
7
|
-
## [2.0.0] — 2026-06-03
|
|
8
|
-
|
|
9
|
-
Lockstep release with `@poolse/sdk@2.0.0` and `@poolse/react-ui@2.0.0`.
|
|
10
|
-
|
|
11
|
-
### Breaking
|
|
12
|
-
|
|
13
|
-
- **`useUser(externalId)`** — was `useUser(userId)`. The hook now
|
|
14
|
-
consumes the tenant's own user id. Pass the value from
|
|
15
|
-
`message.sender_external_id`, `membership.external_id`, or any
|
|
16
|
-
other external_id-shaped field on the wire.
|
|
17
|
-
- **`useTyping(conversationId).typing`** now returns `Set<externalId>`
|
|
18
|
-
(was `Set<userId>`). Same for `usePresence(conversationId).online`.
|
|
19
|
-
- **`useMembers(conversationId).removeMember(externalId)`** — was
|
|
20
|
-
`removeMember(userId)`. The hook translates external_id → user_id
|
|
21
|
-
internally; the DELETE endpoint still takes user_id but you don't
|
|
22
|
-
see it.
|
|
23
|
-
|
|
24
|
-
### Migration
|
|
25
|
-
|
|
26
|
-
See `MIGRATING.md` at the repo root.
|
|
27
|
-
|
|
28
|
-
## [1.1.0] — 2026-06-02
|
|
29
|
-
|
|
30
|
-
Lockstep release with `@poolse/sdk@1.1.0` and `@poolse/react-ui@1.1.0`.
|
|
31
|
-
No API changes in `@poolse/react` itself — version bumped to keep the
|
|
32
|
-
three packages in sync, so customers can pin one version across the
|
|
33
|
-
whole client surface.
|
|
34
|
-
|
|
35
|
-
### Changed
|
|
36
|
-
|
|
37
|
-
- README rewritten with a full per-hook reference: signatures, return
|
|
38
|
-
shapes, the realtime channels each hook subscribes to, the optimistic
|
|
39
|
-
send + thread routing strategy in `useMessages`, the buffered-reads
|
|
40
|
-
race fix in `useMembers`, the cache + dedup semantics in `useUser`,
|
|
41
|
-
and the synchronous-snapshot rollback pattern used by edits and
|
|
42
|
-
optimistic removes.
|
|
43
|
-
- Repo-wide prettier formatting fixes (whitespace only).
|
|
44
|
-
|
|
45
|
-
## [1.0.0-beta.0] — 2026-06-01
|
|
46
|
-
|
|
47
|
-
First beta of the stable API. Promotes the full 0.2.x hook surface
|
|
48
|
-
(useMessages with reply_count routing, useThread with full-thread
|
|
49
|
-
fetch, useMembers with buffered read-receipt events,
|
|
50
|
-
useConversations with unreadCounts + markConversationRead) to a
|
|
51
|
-
stable namespace. No breaking changes relative to `0.2.0-alpha.7`
|
|
52
|
-
— version bump + removed verbose diagnostic logs.
|
|
53
|
-
|
|
54
|
-
## [0.2.0] — 2026-06-01
|
|
55
|
-
|
|
56
|
-
### Fixed
|
|
57
|
-
|
|
58
|
-
- Realtime read receipts now actually fire. The server-side broadcast
|
|
59
|
-
call in `Messaging.do_mark_read` was missing — the alpha.2 commit
|
|
60
|
-
added the channel handler and the SDK subscription but the broadcast
|
|
61
|
-
itself never made it into the commit, so no `member:read` event was
|
|
62
|
-
ever sent. Fixed in the matching server release; `useMembers` also
|
|
63
|
-
logs received events as `[poolse] member:read received` for easy
|
|
64
|
-
observability.
|
|
65
|
-
|
|
66
|
-
### Changed — thread replies routed to reply_count only
|
|
67
|
-
|
|
68
|
-
- `useMessages` no longer adds incoming thread replies to the main
|
|
69
|
-
feed — replies belong to the side-pane that `useThread` populates.
|
|
70
|
-
Realtime `message:new` with `thread_root_id` set now bumps the
|
|
71
|
-
root's `reply_count` and skips the upsert. Matches the new server
|
|
72
|
-
behavior (`WHERE thread_root_id IS NULL` on `list_messages`), so
|
|
73
|
-
refresh and realtime stay consistent.
|
|
74
|
-
- `useThread` default page size raised from 50 → 500 so a typical
|
|
75
|
-
thread loads in one round-trip. `loadMore` remains as an escape
|
|
76
|
-
hatch.
|
|
77
|
-
- `useMembers` now buffers `member:read` events that fire before the
|
|
78
|
-
initial fetch lands, then replays them once members are loaded.
|
|
79
|
-
Fixes the realtime read-receipt race where reads arriving in the
|
|
80
|
-
subscribe → fetch-response window were silently dropped.
|
|
81
|
-
|
|
82
|
-
### Added
|
|
83
|
-
|
|
84
|
-
- `useMessages` now maintains `Message.reply_count` live — increments
|
|
85
|
-
on inbound thread reply, decrements on reply soft-delete. No server
|
|
86
|
-
round-trip; the thread pill in `<MessageRow>` updates immediately.
|
|
87
|
-
|
|
88
|
-
### Fixed
|
|
89
|
-
|
|
90
|
-
- `useMembers` catch path now `console.error`s the underlying error
|
|
91
|
-
with a `[poolse]` prefix so silent failures are debuggable from
|
|
92
|
-
DevTools.
|
|
93
|
-
|
|
94
|
-
### Added (continued)
|
|
95
|
-
|
|
96
|
-
- `useMessages.edit(messageId, body)` — optimistic edit with rollback
|
|
97
|
-
on server error. Server enforces sender-only authorization.
|
|
98
|
-
- `useMessages.delete(messageId)` — optimistic soft-delete (sets
|
|
99
|
-
`deleted_at` + null body locally, rolls back on error).
|
|
100
|
-
- `useMessages.markReadUpTo(messageId)` — wraps
|
|
101
|
-
`chat.conversations.one(id).messages.markRead`; advances the
|
|
102
|
-
caller's read cursor and triggers server-side read-receipt
|
|
103
|
-
broadcasts to other members.
|
|
104
|
-
- `useConversations` now exposes `unreadCounts: Record<convId, number>`
|
|
105
|
-
plus `markConversationRead(convId)` for sidebar-badge UIs.
|
|
106
|
-
- `useThread.edit(messageId, body)` / `useThread.delete(messageId)`
|
|
107
|
-
for inline reply editing inside `<ThreadView>`.
|
|
108
|
-
|
|
109
|
-
### Changed
|
|
110
|
-
|
|
111
|
-
- `useMembers(conversationId)` now treats an empty string id as
|
|
112
|
-
"skip fetch" (returns `{ members: [], loading: false }`) so
|
|
113
|
-
callers can conditionally enable member loading without wrapping
|
|
114
|
-
in a `enabled ?` guard.
|
|
115
|
-
- `useMembers` subscribes to the new `member:read` realtime event
|
|
116
|
-
and advances the matching membership's `last_read_message_id` /
|
|
117
|
-
`last_read_at` in place. The sender's check-double glyph now
|
|
118
|
-
flips in real time without a refetch.
|
|
119
|
-
- Provider auto-resolves the SDK's new default `apiUrl` when none
|
|
120
|
-
is passed in config.
|
|
121
|
-
|
|
122
|
-
## [0.1.1] — 2026-06-01
|
|
123
|
-
|
|
124
|
-
### Fixed
|
|
125
|
-
|
|
126
|
-
- `useMessages.send()` now stamps the optimistic temp message's
|
|
127
|
-
`sender_id` with the current user's id (via `useMe` internally).
|
|
128
|
-
Without this, self-sent messages briefly rendered on the "other"
|
|
129
|
-
side of the chat until the realtime echo replaced them.
|
|
130
|
-
|
|
131
|
-
## [0.1.0] — 2026-06-01
|
|
132
|
-
|
|
133
|
-
First publishable release.
|
|
134
|
-
|
|
135
|
-
### Added
|
|
136
|
-
|
|
137
|
-
- `<PoolseProvider>` — mount-once SDK instance with ref-stable callbacks
|
|
138
|
-
(safe to pass `config={{getToken: () => ...}}` inline on every render).
|
|
139
|
-
- `usePoolse()` — raw `Poolse` instance escape hatch.
|
|
140
|
-
- Realtime hooks: `useMe`, `useConversations`, `useConversation`,
|
|
141
|
-
`useMembers`, `useMessages`, `useThread`, `useReactions`, `useTyping`,
|
|
142
|
-
`usePresence`, `useRealtimeStatus`.
|
|
143
|
-
- Attachments: `useAttachmentUpload`, `useAttachmentUrl`.
|
|
144
|
-
- Real-time conversation list — `useConversations` subscribes to the
|
|
145
|
-
user's `user:<id>` channel and prepends on `conversation:created`
|
|
146
|
-
push (no manual refetch needed).
|
|
147
|
-
- Optimistic message send with id-based dedup: `useMessages.send()`
|
|
148
|
-
inserts under the same id the server will assign, so realtime echo
|
|
149
|
-
upserts in place.
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@poolse/react` are documented here. Format follows
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versions follow
|
|
5
|
+
[semver](https://semver.org).
|
|
6
|
+
|
|
7
|
+
## [2.0.0] — 2026-06-03
|
|
8
|
+
|
|
9
|
+
Lockstep release with `@poolse/sdk@2.0.0` and `@poolse/react-ui@2.0.0`.
|
|
10
|
+
|
|
11
|
+
### Breaking
|
|
12
|
+
|
|
13
|
+
- **`useUser(externalId)`** — was `useUser(userId)`. The hook now
|
|
14
|
+
consumes the tenant's own user id. Pass the value from
|
|
15
|
+
`message.sender_external_id`, `membership.external_id`, or any
|
|
16
|
+
other external_id-shaped field on the wire.
|
|
17
|
+
- **`useTyping(conversationId).typing`** now returns `Set<externalId>`
|
|
18
|
+
(was `Set<userId>`). Same for `usePresence(conversationId).online`.
|
|
19
|
+
- **`useMembers(conversationId).removeMember(externalId)`** — was
|
|
20
|
+
`removeMember(userId)`. The hook translates external_id → user_id
|
|
21
|
+
internally; the DELETE endpoint still takes user_id but you don't
|
|
22
|
+
see it.
|
|
23
|
+
|
|
24
|
+
### Migration
|
|
25
|
+
|
|
26
|
+
See `MIGRATING.md` at the repo root.
|
|
27
|
+
|
|
28
|
+
## [1.1.0] — 2026-06-02
|
|
29
|
+
|
|
30
|
+
Lockstep release with `@poolse/sdk@1.1.0` and `@poolse/react-ui@1.1.0`.
|
|
31
|
+
No API changes in `@poolse/react` itself — version bumped to keep the
|
|
32
|
+
three packages in sync, so customers can pin one version across the
|
|
33
|
+
whole client surface.
|
|
34
|
+
|
|
35
|
+
### Changed
|
|
36
|
+
|
|
37
|
+
- README rewritten with a full per-hook reference: signatures, return
|
|
38
|
+
shapes, the realtime channels each hook subscribes to, the optimistic
|
|
39
|
+
send + thread routing strategy in `useMessages`, the buffered-reads
|
|
40
|
+
race fix in `useMembers`, the cache + dedup semantics in `useUser`,
|
|
41
|
+
and the synchronous-snapshot rollback pattern used by edits and
|
|
42
|
+
optimistic removes.
|
|
43
|
+
- Repo-wide prettier formatting fixes (whitespace only).
|
|
44
|
+
|
|
45
|
+
## [1.0.0-beta.0] — 2026-06-01
|
|
46
|
+
|
|
47
|
+
First beta of the stable API. Promotes the full 0.2.x hook surface
|
|
48
|
+
(useMessages with reply_count routing, useThread with full-thread
|
|
49
|
+
fetch, useMembers with buffered read-receipt events,
|
|
50
|
+
useConversations with unreadCounts + markConversationRead) to a
|
|
51
|
+
stable namespace. No breaking changes relative to `0.2.0-alpha.7`
|
|
52
|
+
— version bump + removed verbose diagnostic logs.
|
|
53
|
+
|
|
54
|
+
## [0.2.0] — 2026-06-01
|
|
55
|
+
|
|
56
|
+
### Fixed
|
|
57
|
+
|
|
58
|
+
- Realtime read receipts now actually fire. The server-side broadcast
|
|
59
|
+
call in `Messaging.do_mark_read` was missing — the alpha.2 commit
|
|
60
|
+
added the channel handler and the SDK subscription but the broadcast
|
|
61
|
+
itself never made it into the commit, so no `member:read` event was
|
|
62
|
+
ever sent. Fixed in the matching server release; `useMembers` also
|
|
63
|
+
logs received events as `[poolse] member:read received` for easy
|
|
64
|
+
observability.
|
|
65
|
+
|
|
66
|
+
### Changed — thread replies routed to reply_count only
|
|
67
|
+
|
|
68
|
+
- `useMessages` no longer adds incoming thread replies to the main
|
|
69
|
+
feed — replies belong to the side-pane that `useThread` populates.
|
|
70
|
+
Realtime `message:new` with `thread_root_id` set now bumps the
|
|
71
|
+
root's `reply_count` and skips the upsert. Matches the new server
|
|
72
|
+
behavior (`WHERE thread_root_id IS NULL` on `list_messages`), so
|
|
73
|
+
refresh and realtime stay consistent.
|
|
74
|
+
- `useThread` default page size raised from 50 → 500 so a typical
|
|
75
|
+
thread loads in one round-trip. `loadMore` remains as an escape
|
|
76
|
+
hatch.
|
|
77
|
+
- `useMembers` now buffers `member:read` events that fire before the
|
|
78
|
+
initial fetch lands, then replays them once members are loaded.
|
|
79
|
+
Fixes the realtime read-receipt race where reads arriving in the
|
|
80
|
+
subscribe → fetch-response window were silently dropped.
|
|
81
|
+
|
|
82
|
+
### Added
|
|
83
|
+
|
|
84
|
+
- `useMessages` now maintains `Message.reply_count` live — increments
|
|
85
|
+
on inbound thread reply, decrements on reply soft-delete. No server
|
|
86
|
+
round-trip; the thread pill in `<MessageRow>` updates immediately.
|
|
87
|
+
|
|
88
|
+
### Fixed
|
|
89
|
+
|
|
90
|
+
- `useMembers` catch path now `console.error`s the underlying error
|
|
91
|
+
with a `[poolse]` prefix so silent failures are debuggable from
|
|
92
|
+
DevTools.
|
|
93
|
+
|
|
94
|
+
### Added (continued)
|
|
95
|
+
|
|
96
|
+
- `useMessages.edit(messageId, body)` — optimistic edit with rollback
|
|
97
|
+
on server error. Server enforces sender-only authorization.
|
|
98
|
+
- `useMessages.delete(messageId)` — optimistic soft-delete (sets
|
|
99
|
+
`deleted_at` + null body locally, rolls back on error).
|
|
100
|
+
- `useMessages.markReadUpTo(messageId)` — wraps
|
|
101
|
+
`chat.conversations.one(id).messages.markRead`; advances the
|
|
102
|
+
caller's read cursor and triggers server-side read-receipt
|
|
103
|
+
broadcasts to other members.
|
|
104
|
+
- `useConversations` now exposes `unreadCounts: Record<convId, number>`
|
|
105
|
+
plus `markConversationRead(convId)` for sidebar-badge UIs.
|
|
106
|
+
- `useThread.edit(messageId, body)` / `useThread.delete(messageId)`
|
|
107
|
+
for inline reply editing inside `<ThreadView>`.
|
|
108
|
+
|
|
109
|
+
### Changed
|
|
110
|
+
|
|
111
|
+
- `useMembers(conversationId)` now treats an empty string id as
|
|
112
|
+
"skip fetch" (returns `{ members: [], loading: false }`) so
|
|
113
|
+
callers can conditionally enable member loading without wrapping
|
|
114
|
+
in a `enabled ?` guard.
|
|
115
|
+
- `useMembers` subscribes to the new `member:read` realtime event
|
|
116
|
+
and advances the matching membership's `last_read_message_id` /
|
|
117
|
+
`last_read_at` in place. The sender's check-double glyph now
|
|
118
|
+
flips in real time without a refetch.
|
|
119
|
+
- Provider auto-resolves the SDK's new default `apiUrl` when none
|
|
120
|
+
is passed in config.
|
|
121
|
+
|
|
122
|
+
## [0.1.1] — 2026-06-01
|
|
123
|
+
|
|
124
|
+
### Fixed
|
|
125
|
+
|
|
126
|
+
- `useMessages.send()` now stamps the optimistic temp message's
|
|
127
|
+
`sender_id` with the current user's id (via `useMe` internally).
|
|
128
|
+
Without this, self-sent messages briefly rendered on the "other"
|
|
129
|
+
side of the chat until the realtime echo replaced them.
|
|
130
|
+
|
|
131
|
+
## [0.1.0] — 2026-06-01
|
|
132
|
+
|
|
133
|
+
First publishable release.
|
|
134
|
+
|
|
135
|
+
### Added
|
|
136
|
+
|
|
137
|
+
- `<PoolseProvider>` — mount-once SDK instance with ref-stable callbacks
|
|
138
|
+
(safe to pass `config={{getToken: () => ...}}` inline on every render).
|
|
139
|
+
- `usePoolse()` — raw `Poolse` instance escape hatch.
|
|
140
|
+
- Realtime hooks: `useMe`, `useConversations`, `useConversation`,
|
|
141
|
+
`useMembers`, `useMessages`, `useThread`, `useReactions`, `useTyping`,
|
|
142
|
+
`usePresence`, `useRealtimeStatus`.
|
|
143
|
+
- Attachments: `useAttachmentUpload`, `useAttachmentUrl`.
|
|
144
|
+
- Real-time conversation list — `useConversations` subscribes to the
|
|
145
|
+
user's `user:<id>` channel and prepends on `conversation:created`
|
|
146
|
+
push (no manual refetch needed).
|
|
147
|
+
- Optimistic message send with id-based dedup: `useMessages.send()`
|
|
148
|
+
inserts under the same id the server will assign, so realtime echo
|
|
149
|
+
upserts in place.
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Poolse
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Poolse
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|