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

fix(websockets): refetch on reconnect MAASENG-2142 #5146

Conversation

petermakowski
Copy link
Collaborator

@petermakowski petermakowski commented Sep 7, 2023

Done

  • fix(websockets): refetch all WS endpoints on reconnect
  • add useFetchActions hook that runs a set of actions on mount and every time websocket reconnects
  • replace all instances of useEffect with fetch actions on mount with useFetchActions
  • add connectedCount to redux store to keep track of the number of times the websocket has connected successfully
  • stop websocket ping on disconnect via handlePingStop
  • run invalidateQueries on websocket disconnect to mark machine list and count requests as stale

QA

QA steps

  1. go to machine list
  2. Open one of the machines visible in the list in another tab
  3. restart MAAS
  4. wait for front-end to reconnect
  5. In the tab with machine details, make changes to the machine that will change its status (e.g. start testing)
  6. Verify that the machine list in the other tab has been updated to reflect this change

Fixes

Fixes: MAASENG-2142

Launchpad issue

lp#1930001

@webteam-app
Copy link

Demo starting at https://maas-ui-5146.demos.haus

@petermakowski petermakowski force-pushed the fix-websockets-refetch-on-reconnect-MAASENG-2142 branch 3 times, most recently from 3bba209 to 2a01696 Compare September 7, 2023 08:59
@petermakowski petermakowski changed the title fix(websockets): refetch on reconnect MAASENG-2142 fix(websockets): refetch on reconnect MAASENG-2142 WIP Sep 7, 2023
@petermakowski petermakowski force-pushed the fix-websockets-refetch-on-reconnect-MAASENG-2142 branch from 2a01696 to f81ec26 Compare September 7, 2023 10:52
@petermakowski petermakowski changed the title fix(websockets): refetch on reconnect MAASENG-2142 WIP fix(websockets): refetch on reconnect MAASENG-2142 Sep 7, 2023
@petermakowski petermakowski marked this pull request as ready for review September 7, 2023 11:17
@petermakowski petermakowski force-pushed the fix-websockets-refetch-on-reconnect-MAASENG-2142 branch 2 times, most recently from c5af519 to 116b117 Compare September 7, 2023 12:05
@petermakowski petermakowski force-pushed the fix-websockets-refetch-on-reconnect-MAASENG-2142 branch from 116b117 to 7c3f9d6 Compare September 7, 2023 12:07
@petermakowski petermakowski force-pushed the fix-websockets-refetch-on-reconnect-MAASENG-2142 branch 2 times, most recently from 5ea8db5 to 4908d34 Compare September 7, 2023 13:26
- add `useFetchActions` hook
- replace `useEffect` with fetch actions on mount with `useFetchActions`
- add `connectedCount` to redux store
@petermakowski petermakowski force-pushed the fix-websockets-refetch-on-reconnect-MAASENG-2142 branch from 4908d34 to 62a8d4b Compare September 7, 2023 14:28
@petermakowski petermakowski merged commit 0b49454 into canonical:main Sep 7, 2023
4 checks passed
petermakowski added a commit to petermakowski/maas-ui that referenced this pull request Sep 8, 2023
- add `connectedCount` to redux store
- stop WebSocket ping on disconnect
- run invalidateQueries on disconnect
- run `useFetchActions` hook on reconnect
petermakowski added a commit that referenced this pull request Sep 8, 2023
#5152)

- add `connectedCount` to redux store
- stop WebSocket ping on disconnect
- run invalidateQueries on disconnect
- run `useFetchActions` hook on reconnect
- test: update Preferences.test.tsx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants