feat(ui): disable invoke button during publish operation

This commit is contained in:
psychedelicious
2025-03-31 14:12:41 +10:00
parent 4289241943
commit b056c93ea3
3 changed files with 11 additions and 3 deletions

View File

@@ -1805,7 +1805,8 @@
"publishFailed": "Publish failed",
"publishFailedDesc": "There was a problem publishing the workflow. Please try again.",
"publishSuccess": "Workflow publish started",
"publishSuccessDesc": "Your workflow is being published. Check your Project Dashboard to see its progress."
"publishSuccessDesc": "Your workflow is being published. Check your Project Dashboard to see its progress.",
"publishInProgress": "Publishing in Progress"
}
},
"controlLayers": {

View File

@@ -6,6 +6,7 @@ import { selectSendToCanvas } from 'features/controlLayers/store/canvasSettingsS
import { selectIterations } from 'features/controlLayers/store/paramsSlice';
import { selectDynamicPromptsIsLoading } from 'features/dynamicPrompts/store/dynamicPromptsSlice';
import { selectAutoAddBoardId } from 'features/gallery/store/gallerySelectors';
import { $isInPublishFlow } from 'features/nodes/components/sidePanel/workflow/publish';
import { selectNodesSlice } from 'features/nodes/store/selectors';
import type { NodesState } from 'features/nodes/store/types';
import type { BatchSizeResult } from 'features/nodes/util/node/resolveBatchValue';
@@ -175,6 +176,7 @@ const IsReadyText = memo(({ isReady, prepend }: { isReady: boolean; prepend: boo
const { t } = useTranslation();
const isLoadingDynamicPrompts = useAppSelector(selectDynamicPromptsIsLoading);
const [_, enqueueMutation] = useEnqueueBatchMutation(enqueueMutationFixedCacheKeyOptions);
const isInPublishFlow = useStore($isInPublishFlow);
const text = useMemo(() => {
if (enqueueMutation.isLoading) {
@@ -183,6 +185,9 @@ const IsReadyText = memo(({ isReady, prepend }: { isReady: boolean; prepend: boo
if (isLoadingDynamicPrompts) {
return t('dynamicPrompts.loading');
}
if (isInPublishFlow) {
return t('workflows.builder.publishInProgress');
}
if (isReady) {
if (prepend) {
return t('queue.queueFront');
@@ -190,7 +195,7 @@ const IsReadyText = memo(({ isReady, prepend }: { isReady: boolean; prepend: boo
return t('queue.queueBack');
}
return t('queue.notReady');
}, [enqueueMutation.isLoading, isLoadingDynamicPrompts, isReady, prepend, t]);
}, [enqueueMutation.isLoading, isLoadingDynamicPrompts, isInPublishFlow, isReady, prepend, t]);
return <Text fontWeight="semibold">{text}</Text>;
});

View File

@@ -5,6 +5,7 @@ import { enqueueRequestedUpscaling } from 'app/store/middleware/listenerMiddlewa
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
import { withResultAsync } from 'common/util/result';
import { parseify } from 'common/util/serialize';
import { $isInPublishFlow } from 'features/nodes/components/sidePanel/workflow/publish';
import { useEnqueueWorkflows } from 'features/queue/hooks/useEnqueueWorkflows';
import { $isReadyToEnqueue } from 'features/queue/store/readiness';
import { selectActiveTab } from 'features/ui/store/uiSelectors';
@@ -18,6 +19,7 @@ export const useInvoke = () => {
const dispatch = useAppDispatch();
const tabName = useAppSelector(selectActiveTab);
const isReady = useStore($isReadyToEnqueue);
const isInPublishFlow = useStore($isInPublishFlow);
const enqueueWorkflows = useEnqueueWorkflows();
const [_, { isLoading }] = useEnqueueBatchMutation(enqueueMutationFixedCacheKeyOptions);
@@ -60,5 +62,5 @@ export const useInvoke = () => {
enqueue(true, false);
}, [enqueue]);
return { enqueueBack, enqueueFront, isLoading, isDisabled: !isReady, enqueue };
return { enqueueBack, enqueueFront, isLoading, isDisabled: !isReady || isInPublishFlow, enqueue };
};