@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/dist/index.mjs
CHANGED
|
@@ -8884,7 +8884,21 @@ function ChatProvider({ children, autoConnect = true }) {
|
|
|
8884
8884
|
const baseUrl = client.baseUrl;
|
|
8885
8885
|
const host = new URL(baseUrl).origin;
|
|
8886
8886
|
chatSocket.setListeners({
|
|
8887
|
-
|
|
8887
|
+
// Refetch the message list whenever the socket reaches 'connected'.
|
|
8888
|
+
// Covers both the initial connect AND every reconnect (app resumed
|
|
8889
|
+
// from background, transient network blip, server restart). Without
|
|
8890
|
+
// this, the provider's `messages` state is frozen at whatever it was
|
|
8891
|
+
// when the app last connected — Socket.IO's auto-reconnect resumes
|
|
8892
|
+
// delivery of *new* events but does not replay the gap.
|
|
8893
|
+
onConnectionChange: (next) => {
|
|
8894
|
+
setStatus(next);
|
|
8895
|
+
if (next === "connected") {
|
|
8896
|
+
refreshMessages().catch(() => {
|
|
8897
|
+
});
|
|
8898
|
+
refreshConversations().catch(() => {
|
|
8899
|
+
});
|
|
8900
|
+
}
|
|
8901
|
+
},
|
|
8888
8902
|
// Global chat
|
|
8889
8903
|
onNewMessage: (msg) => {
|
|
8890
8904
|
setMessages((prev) => {
|
|
@@ -8909,12 +8923,22 @@ function ChatProvider({ children, autoConnect = true }) {
|
|
|
8909
8923
|
if (n.type === "friend_request_declined") refreshSentFriendRequests();
|
|
8910
8924
|
if (n.type === "whats_new") refreshWhatsNew();
|
|
8911
8925
|
},
|
|
8926
|
+
// These events now fan out to BOTH parties (server emits to actor's
|
|
8927
|
+
// own room as well), so each handler refreshes every list that could
|
|
8928
|
+
// be affected — works whether this client is the actor or the target.
|
|
8912
8929
|
onFriendRequestAccepted: () => {
|
|
8913
8930
|
refreshFriends();
|
|
8931
|
+
refreshPendingRequests();
|
|
8932
|
+
refreshSentFriendRequests();
|
|
8933
|
+
},
|
|
8934
|
+
onFriendRequestDeclined: () => {
|
|
8935
|
+
refreshPendingRequests();
|
|
8936
|
+
refreshSentFriendRequests();
|
|
8937
|
+
},
|
|
8938
|
+
onFriendRequestCancelled: () => {
|
|
8939
|
+
refreshPendingRequests();
|
|
8914
8940
|
refreshSentFriendRequests();
|
|
8915
8941
|
},
|
|
8916
|
-
onFriendRequestDeclined: () => refreshSentFriendRequests(),
|
|
8917
|
-
onFriendRequestCancelled: () => refreshPendingRequests(),
|
|
8918
8942
|
onFriendRemoved: () => refreshFriends()
|
|
8919
8943
|
});
|
|
8920
8944
|
chatSocket.connect({ host, token });
|