feat(ui): improve comments on socketConnected listener

This commit is contained in:
psychedelicious 2024-01-09 19:03:39 +11:00
parent f25b6ee5d1
commit 936d19cd60

View File

@ -24,11 +24,13 @@ export const addSocketConnectedEventListener = () => {
/** /**
* The rest of this listener has recovery logic for when the socket disconnects and reconnects. * The rest of this listener has recovery logic for when the socket disconnects and reconnects.
* If we had generations in progress, we need to reset the API state to re-fetch everything. *
* If a queue item completed during while disconnected, we need to reset the API state to re-
* fetch everything, updating the gallery and queue.
*/ */
if ($isFirstConnection.get()) { if ($isFirstConnection.get()) {
// Bail on the recovery logic if this is the first connection // Bail on the recovery logic if this is the first connection - we don't need to recover anything
$isFirstConnection.set(false); $isFirstConnection.set(false);
return; return;
} }
@ -93,6 +95,7 @@ export const addSocketConnectedEventListener = () => {
actionCreator: socketConnected, actionCreator: socketConnected,
effect: async (action, { dispatch, getState }) => { effect: async (action, { dispatch, getState }) => {
const { nodeTemplates, config } = getState(); const { nodeTemplates, config } = getState();
// We only want to re-fetch the schema if we don't have any node templates
if ( if (
!size(nodeTemplates.templates) && !size(nodeTemplates.templates) &&
!config.disabledTabs.includes('nodes') !config.disabledTabs.includes('nodes')