Skip to content

Fixed session clean-up, websocket connection, and data loading logic#43

Merged
tieneupin merged 27 commits intomainfrom
fix-session-cleanup
Jul 25, 2025
Merged

Fixed session clean-up, websocket connection, and data loading logic#43
tieneupin merged 27 commits intomainfrom
fix-session-cleanup

Conversation

@tieneupin
Copy link
Collaborator

@tieneupin tieneupin commented Jul 23, 2025

This PR introduces a variety of improvements

  • Improved session cleanup logic
    • Adds a state to keep track of whether a session is in the midst of being cleaned up, which makes use of a new attribute in the MultigridController object in Murfey (see PR #641)
    • Visibly changes the SessionRow component to show when sessions are in progress, being cleaned up, or inactive
  • Improved web socket logic
    • Migrated the web socket setup logic to its own standalone components file
    • Run the WebSocketHandler in the ProtectedRoutes component, which all session-related pages inherit from
    • Use the new messages introduced in PR #641 to refetch queries, making app more reactive.
  • Improved reactivity of components via the use of queries
    • Session page will now stop polling the backend when connection with the instrument server is lost
    • SessionRows in the Home page will now update their status when the instrument server connection is lost
    • Processing parameters can now be edited seamlessly without a browser update
  • Other bug fixes and improvements
    • Fixed the instrument server connectivity status indicator so that the tooltip pop-up appears and disappears correctly
    • Removed the need for URL rewriting when navigating to an instrument's Home page by optimising the data fetching logic
    • Renamed the sessionsLoader to allSessionsLoader so that it's easier to distinguish from sessionLoader.

tieneupin added 17 commits July 21, 2025 16:28
…dated the redirect check in the 'Session' route to use the new data structure
* Added a state to keep track of whether the session is being cleaned up
* Disables the bin and broom buttons when a session is being cleaned up
* Changes the PuffLoader color logic; it's green when a transfer is in progress, red when cleaning up, and a static grey when the session is disconnected
* Renamed 'getSessionsData' to 'getAllSessionsData' to better distinguish it from 'getSessionData'
* Similarly renamed 'sessionsLoader' to 'allSessionsLoader'
* Migrated query-based functions and variables into the loaders they are called in, to keep dependencies focused
* Used `invalidateQueries` in loaders to make sure that fresh data is fetched from the backend every time a page with session-related information is loaded
…ssage appears and disappears correctly; also fixed incorrect polling interval in comment
* Removed the 'useEffect()' for cleaning up the URl now that URL query parameters are no longer needed
* Rearranged defined variables and functions by type
* Added comments
… then implemented inside 'ProtectedRoutes' so that it persists when navigating across all relevant pages
…f 'useLoaderData'

* Changed 'allSessionsLoader' loader function to return 'queryClient.ensureQueryData()' to prefetch and catch session information before route renders
* Pass it the instrument name from the 'Home' route
* Use 'queryClient.refetchQueries()' to update the loaded session information after a delete instead of refreshing the window
…'sessionActive' state and closes the pop-up after successful execution
@tieneupin tieneupin self-assigned this Jul 23, 2025
@tieneupin tieneupin added bug Something isn't working enhancement New feature or request labels Jul 23, 2025
@tieneupin tieneupin requested a review from d-j-hatton July 23, 2025 11:04
* Use a query to fetch and update RSyncer data from the backend
* Remove the need to pass functions to the RSyncCard components now that we are using queries
* Added logic to stop polling when the instrument server connection is lost
@tieneupin tieneupin merged commit 2946655 into main Jul 25, 2025
@tieneupin tieneupin deleted the fix-session-cleanup branch July 25, 2025 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant