feat(ui): if in dev mode, reset API on reconnect

This retains the current good developer experience when working on the server - the UI should fully reset when you restart the server.
This commit is contained in:
psychedelicious 2024-01-10 07:13:28 +11:00
parent 9fcc30c3d6
commit ff09fd30dc

View File

@ -38,6 +38,12 @@ export const addSocketConnectedEventListener = () => {
return;
}
// If we are in development mode, reset the whole API state. In this scenario, reconnects will
// typically be caused by reloading the server, in which case we do want to reset the whole API.
if (import.meta.env.MODE === 'development') {
dispatch(api.util.resetApiState());
}
// Else, we need to compare the last-known queue status with the current queue status, re-fetching
// everything if it has changed.