fix(plugin-workflow): fix occasional error on enter workflow page (#2086)

This commit is contained in:
Junyi 2023-06-21 09:53:31 +07:00 committed by GitHub
parent 5672ffc9fa
commit 56e6d0c3b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -141,6 +141,7 @@ export const TriggerConfig = () => {
const { workflow, refresh } = useFlowContext(); const { workflow, refresh } = useFlowContext();
const [editingTitle, setEditingTitle] = useState<string>(''); const [editingTitle, setEditingTitle] = useState<string>('');
const [editingConfig, setEditingConfig] = useState(false); const [editingConfig, setEditingConfig] = useState(false);
let typeTitle = '';
useEffect(() => { useEffect(() => {
if (workflow) { if (workflow) {
setEditingTitle(workflow.title ?? typeTitle); setEditingTitle(workflow.title ?? typeTitle);
@ -151,7 +152,9 @@ export const TriggerConfig = () => {
return null; return null;
} }
const { title, type, config, executed } = workflow; const { title, type, config, executed } = workflow;
const { title: typeTitle, fieldset, scope, components } = triggers.get(type); const trigger = triggers.get(type);
const { fieldset, scope, components } = trigger;
typeTitle = trigger.title;
const detailText = executed ? '{{t("View")}}' : '{{t("Configure")}}'; const detailText = executed ? '{{t("View")}}' : '{{t("Configure")}}';
const titleText = `${lang('Trigger')}: ${compile(typeTitle)}`; const titleText = `${lang('Trigger')}: ${compile(typeTitle)}`;