ontime icon indicating copy to clipboard operation
ontime copied to clipboard

Refact/feature sockets

Open cpvalente opened this issue 2 years ago • 1 comments

This PR is setting ground for upcoming features in the interface. It should help with separation of concerns between features and to resolve issues with multiple listeners on sockets.

cpvalente avatar Aug 14 '22 20:08 cpvalente

Code-wise what we achieved here is that we removed the socket logic from the components and abstracted it out inside this socket provider hook.

As I understood we call this hook at the root component, which will subscribe to socket messages and store their values inside React Query store. That way we can use the React Query APIs to fetch and mutate the data, for the user there will be no distinction API-wise on what is REST and what is WebSocket.

I'm not the biggest fan of that hook being called at the root component, as we discussed it don't seem to belong there because of the namings. The solution would be to have more components composing the root. But that's not critical.

I think this is good.

alexrohleder avatar Aug 29 '22 15:08 alexrohleder