Skip to content

Commit

Permalink
Ignore Push events when offline with devtools
Browse files Browse the repository at this point in the history
  • Loading branch information
neil-marcellini committed Nov 28, 2022
1 parent 41fa6c1 commit e4d0e3f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/libs/Pusher/pusher.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import Pusher from './library';
import TYPE from './EventType';
import Log from '../Log';

let shouldForceOffline = false;
let isOffline = false;
Onyx.connect({
key: ONYXKEYS.NETWORK,
callback: (network) => {
if (!network) {
return;
}
shouldForceOffline = Boolean(network.shouldForceOffline);
isOffline = Boolean(network.shouldForceOffline) || network.isOffline;
},
});

Expand Down Expand Up @@ -125,8 +125,8 @@ function bindEventToChannel(channel, eventName, eventCallback = () => {}) {

const chunkedDataEvents = {};
const callback = (eventData) => {
if (shouldForceOffline) {
Log.info('[Pusher] Ignoring a Push event because shouldForceOffline = true');
if (isOffline) {
Log.info('[Pusher] Ignoring Push event because isOffline = true');
return;
}

Expand Down

0 comments on commit e4d0e3f

Please sign in to comment.