diff --git a/src/libs/Pusher/EventType.ts b/src/libs/Pusher/EventType.ts index 89e8a0ca02600..f1f0592aeac64 100644 --- a/src/libs/Pusher/EventType.ts +++ b/src/libs/Pusher/EventType.ts @@ -10,5 +10,6 @@ export default { MULTIPLE_EVENTS: 'multipleEvents', MULTIPLE_EVENT_TYPE: { ONYX_API_UPDATE: 'onyxApiUpdate', + RECONNECT_APP: 'reconnectApp', }, } as const; diff --git a/src/libs/actions/User.ts b/src/libs/actions/User.ts index d2513ce744541..d64cf6fad3b24 100644 --- a/src/libs/actions/User.ts +++ b/src/libs/actions/User.ts @@ -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'; @@ -905,6 +906,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(); + }); } /**