Skip to content

Commit

Permalink
Merge pull request #48784 from Expensify/ionatan_reconnectappevent
Browse files Browse the repository at this point in the history
ReconnectApp when we receive the reconnectApp event
  • Loading branch information
danieldoglas authored Sep 17, 2024
2 parents fe43a4d + 5eb06e9 commit 7893991
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/libs/Pusher/EventType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ export default {
MULTIPLE_EVENTS: 'multipleEvents',
MULTIPLE_EVENT_TYPE: {
ONYX_API_UPDATE: 'onyxApiUpdate',
RECONNECT_APP: 'reconnectApp',
},
} as const;
8 changes: 8 additions & 0 deletions src/libs/actions/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import type OnyxPersonalDetails from '@src/types/onyx/PersonalDetails';
import type {Status} from '@src/types/onyx/PersonalDetails';
import type ReportAction from '@src/types/onyx/ReportAction';
import {isEmptyObject} from '@src/types/utils/EmptyObject';
import * as App from './App';
import applyOnyxUpdatesReliably from './applyOnyxUpdatesReliably';
import * as Link from './Link';
import * as Report from './Report';
Expand Down Expand Up @@ -909,6 +910,13 @@ function subscribeToUserEvents() {
return onyxUpdatePromise;
});
});

// We have an event to reconnect the App. It is triggered when we detect that the user passed updateID
// is not in the DB
PusherUtils.subscribeToMultiEvent(Pusher.TYPE.MULTIPLE_EVENT_TYPE.RECONNECT_APP, () => {
App.reconnectApp();
return Promise.resolve();
});
}

/**
Expand Down

0 comments on commit 7893991

Please sign in to comment.