mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-04-23 03:00:31 -04:00
fix(ui): edge case resulting in no node templates when loading workflow, causing failure
Depending on the user behaviour and network conditions, it's possible that we could try to load a workflow before the invocation templates are available. Fix is simple: - Use the RTKQ query hook for openAPI schema in App.tsx - Disable the load workflow buttons until w have templates parsed
This commit is contained in:
committed by
Kent Keirsey
parent
ca186bca61
commit
ba8bed6870
@@ -1,15 +1,19 @@
|
||||
import { MenuItem } from '@invoke-ai/ui-library';
|
||||
import { useStore } from '@nanostores/react';
|
||||
import { $templates } from 'features/nodes/store/nodesSlice';
|
||||
import { useLoadWorkflowFromGraphModal } from 'features/workflowLibrary/components/LoadWorkflowFromGraphModal/LoadWorkflowFromGraphModal';
|
||||
import { size } from 'lodash-es';
|
||||
import { memo } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { PiFlaskBold } from 'react-icons/pi';
|
||||
|
||||
const LoadWorkflowFromGraphMenuItem = () => {
|
||||
const { t } = useTranslation();
|
||||
const templates = useStore($templates);
|
||||
const { onOpen } = useLoadWorkflowFromGraphModal();
|
||||
|
||||
return (
|
||||
<MenuItem as="button" icon={<PiFlaskBold />} onClick={onOpen}>
|
||||
<MenuItem as="button" icon={<PiFlaskBold />} onClick={onOpen} isDisabled={!size(templates)}>
|
||||
{t('workflows.loadFromGraph')}
|
||||
</MenuItem>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user