Skip to content
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
8 changes: 8 additions & 0 deletions src/libs/NetworkConnection.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ function onReconnect(callback) {
return () => delete reconnectionCallbacks[currentID];
}

/**
* Delete all queued reconnection callbacks
*/
function clearReconnectionCallbacks() {
_.each(_.keys(reconnectionCallbacks), key => delete reconnectionCallbacks[key]);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NAB We could also change const reconnectionCallbacks = {} to let reconnectionCallbacks = {} and then assign it to an empty object here.

Suggested change
_.each(_.keys(reconnectionCallbacks), key => delete reconnectionCallbacks[key]);
reconnectionCallbacks = {};

}

/**
* Refresh NetInfo state.
*/
Expand All @@ -134,6 +141,7 @@ function recheckNetworkConnection() {
}

export default {
clearReconnectionCallbacks,
setOfflineStatus,
listenForReconnect,
onReconnect,
Expand Down
4 changes: 4 additions & 0 deletions src/libs/actions/SignInRedirect.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import ONYXKEYS from '../../ONYXKEYS';
import * as MainQueue from '../Network/MainQueue';
import DateUtils from '../DateUtils';
import * as Localize from '../Localize';
import * as PersistedRequests from './PersistedRequests';
import NetworkConnection from '../NetworkConnection';

let currentActiveClients;
Onyx.connect({
Expand Down Expand Up @@ -74,6 +76,8 @@ function clearStorageAndRedirect(errorMessage) {
*/
function redirectToSignIn(errorMessage) {
MainQueue.clear();
PersistedRequests.clear();
NetworkConnection.clearReconnectionCallbacks();
clearStorageAndRedirect(errorMessage);
}

Expand Down