@dubsdotapp/expo 0.5.25 → 0.5.27
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/dist/index.js +27 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/chat/provider.tsx +25 -3
package/package.json
CHANGED
package/src/chat/provider.tsx
CHANGED
|
@@ -155,7 +155,19 @@ export function ChatProvider({ children, autoConnect = true }: ChatProviderProps
|
|
|
155
155
|
const host = new URL(baseUrl).origin;
|
|
156
156
|
|
|
157
157
|
chatSocket.setListeners({
|
|
158
|
-
|
|
158
|
+
// Refetch the message list whenever the socket reaches 'connected'.
|
|
159
|
+
// Covers both the initial connect AND every reconnect (app resumed
|
|
160
|
+
// from background, transient network blip, server restart). Without
|
|
161
|
+
// this, the provider's `messages` state is frozen at whatever it was
|
|
162
|
+
// when the app last connected — Socket.IO's auto-reconnect resumes
|
|
163
|
+
// delivery of *new* events but does not replay the gap.
|
|
164
|
+
onConnectionChange: (next) => {
|
|
165
|
+
setStatus(next);
|
|
166
|
+
if (next === 'connected') {
|
|
167
|
+
refreshMessages().catch(() => {});
|
|
168
|
+
refreshConversations().catch(() => {});
|
|
169
|
+
}
|
|
170
|
+
},
|
|
159
171
|
// Global chat
|
|
160
172
|
onNewMessage: (msg) => {
|
|
161
173
|
setMessages((prev) => {
|
|
@@ -184,12 +196,22 @@ export function ChatProvider({ children, autoConnect = true }: ChatProviderProps
|
|
|
184
196
|
// What's New posts: a developer published a new one for this app
|
|
185
197
|
if (n.type === 'whats_new') refreshWhatsNew();
|
|
186
198
|
},
|
|
199
|
+
// These events now fan out to BOTH parties (server emits to actor's
|
|
200
|
+
// own room as well), so each handler refreshes every list that could
|
|
201
|
+
// be affected — works whether this client is the actor or the target.
|
|
187
202
|
onFriendRequestAccepted: () => {
|
|
188
203
|
refreshFriends();
|
|
204
|
+
refreshPendingRequests();
|
|
205
|
+
refreshSentFriendRequests();
|
|
206
|
+
},
|
|
207
|
+
onFriendRequestDeclined: () => {
|
|
208
|
+
refreshPendingRequests();
|
|
209
|
+
refreshSentFriendRequests();
|
|
210
|
+
},
|
|
211
|
+
onFriendRequestCancelled: () => {
|
|
212
|
+
refreshPendingRequests();
|
|
189
213
|
refreshSentFriendRequests();
|
|
190
214
|
},
|
|
191
|
-
onFriendRequestDeclined: () => refreshSentFriendRequests(),
|
|
192
|
-
onFriendRequestCancelled: () => refreshPendingRequests(),
|
|
193
215
|
onFriendRemoved: () => refreshFriends(),
|
|
194
216
|
});
|
|
195
217
|
|