diff options
| author | Henry Jameson <spam@hjkos.com> | 2021-01-13 21:33:20 +0200 |
|---|---|---|
| committer | Henry Jameson <spam@hjkos.com> | 2021-01-13 21:33:20 +0200 |
| commit | 48bef143d86b02d7feeeac3e1faa0e5e00e09ea6 (patch) | |
| tree | 394beb9f48cff6d13bde925c275142f64abc07df /src/modules/api.js | |
| parent | 64fa662644dd385dd746f2b309eef6287f5eae04 (diff) | |
fix not being able to re-enable sockets until page refresh
Diffstat (limited to 'src/modules/api.js')
| -rw-r--r-- | src/modules/api.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/modules/api.js b/src/modules/api.js index 01c65e49..2be0f236 100644 --- a/src/modules/api.js +++ b/src/modules/api.js @@ -40,7 +40,16 @@ const api = { // Global MastoAPI socket control, in future should disable ALL sockets/(re)start relevant sockets enableMastoSockets (store) { const { state, dispatch } = store - if (state.mastoUserSocket) return + // Do not initialize unless nonexistent or closed + if ( + state.mastoUserSocket && + ![ + WebSocket.CLOSED, + WebSocket.CLOSING + ].includes(state.mastoUserSocket.getState()) + ) { + return + } return dispatch('startMastoUserSocket') }, disableMastoSockets (store) { |
