@dubsdotapp/expo 0.5.26 → 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 +15 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/chat/provider.tsx +13 -1
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) => {
|