Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReconnectApp when we receive the reconnectApp event #48784

Merged
merged 4 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -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();
});
}

/**
Expand Down
Loading