@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 CHANGED
@@ -8857,7 +8857,21 @@ function ChatProvider({ children, autoConnect = true }) {
8857
8857
  const baseUrl = client.baseUrl;
8858
8858
  const host = new URL(baseUrl).origin;
8859
8859
  chatSocket.setListeners({
8860
- onConnectionChange: setStatus,
8860
+ // Refetch the message list whenever the socket reaches 'connected'.
8861
+ // Covers both the initial connect AND every reconnect (app resumed
8862
+ // from background, transient network blip, server restart). Without
8863
+ // this, the provider's `messages` state is frozen at whatever it was
8864
+ // when the app last connected — Socket.IO's auto-reconnect resumes
8865
+ // delivery of *new* events but does not replay the gap.
8866
+ onConnectionChange: (next) => {
8867
+ setStatus(next);
8868
+ if (next === "connected") {
8869
+ refreshMessages().catch(() => {
8870
+ });
8871
+ refreshConversations().catch(() => {
8872
+ });
8873
+ }
8874
+ },
8861
8875
  // Global chat
8862
8876
  onNewMessage: (msg) => {
8863
8877
  setMessages((prev) => {
@@ -8882,12 +8896,22 @@ function ChatProvider({ children, autoConnect = true }) {
8882
8896
  if (n.type === "friend_request_declined") refreshSentFriendRequests();
8883
8897
  if (n.type === "whats_new") refreshWhatsNew();
8884
8898
  },
8899
+ // These events now fan out to BOTH parties (server emits to actor's
8900
+ // own room as well), so each handler refreshes every list that could
8901
+ // be affected — works whether this client is the actor or the target.
8885
8902
  onFriendRequestAccepted: () => {
8886
8903
  refreshFriends();
8904
+ refreshPendingRequests();
8905
+ refreshSentFriendRequests();
8906
+ },
8907
+ onFriendRequestDeclined: () => {
8908
+ refreshPendingRequests();
8909
+ refreshSentFriendRequests();
8910
+ },
8911
+ onFriendRequestCancelled: () => {
8912
+ refreshPendingRequests();
8887
8913
  refreshSentFriendRequests();
8888
8914
  },
8889
- onFriendRequestDeclined: () => refreshSentFriendRequests(),
8890
- onFriendRequestCancelled: () => refreshPendingRequests(),
8891
8915
  onFriendRemoved: () => refreshFriends()
8892
8916
  });
8893
8917
  chatSocket.connect({ host, token });