Skip to content

Commit

Permalink
prevent resetting lastDisconnectAt if it already exists to avoid user…
Browse files Browse the repository at this point in the history
… fetch bug on WS reconnect

Changelog: fixed
  • Loading branch information
Boris Trombert committed Oct 4, 2024
1 parent 8cf11fe commit d5a721a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 3 additions & 1 deletion webapp/channels/src/actions/websocket_actions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -333,10 +333,12 @@ export async function reconnect(socketId) {
});

if (state.websocket.lastDisconnectAt) {
console.log('lastConnectAt', state.websocket.lastConnectAt);
console.log('lastDisconnectAt', state.websocket.lastDisconnectAt);
// eslint-disable-next-line no-console
console.log('[websocket_actions] lastDisconnectAt: ', state.websocket.lastDisconnectAt);
dispatch(checkForModifiedUsers(true));
dispatch(TeamActions.getMyKSuites());
console.log('[websocket_actions] lastDisconnectAt: ', state.websocket.lastDisconnectAt);
}

dispatch(resetWsErrorCount());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,12 @@ export default function reducer(state = getInitialState(), action: AnyAction) {
return {
...state,
connected: false,
lastDisconnectAt: action.timestamp,
lastDisconnectAt: state.lastDisconnectAt || action.timestamp,
};
}

if (action.type === UserTypes.LOGOUT_SUCCESS) {
return getInitialState();
}

if (action.type === UserTypes.LOGOUT_SUCCESS) {
console.log('RESET WS STATE');
return getInitialState();
}

Expand Down

0 comments on commit d5a721a

Please sign in to comment.