fix(plugin-workflow): fix test button variable (#5766)

This commit is contained in:
Junyi 2024-12-02 21:04:44 +08:00 committed by GitHub
parent 0fbe4f0229
commit 23c23307fa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -159,9 +159,6 @@ export function useAvailableUpstreams(node, filter?) {
*/ */
export function useUpstreamScopes(node) { export function useUpstreamScopes(node) {
const stack: any[] = []; const stack: any[] = [];
if (!node) {
return [];
}
for (let current = node; current; current = current.upstream) { for (let current = node; current; current = current.upstream) {
if (current.upstream && current.branchIndex != null) { if (current.upstream && current.branchIndex != null) {
@ -406,11 +403,12 @@ function TestButton() {
const form = useMemo(() => createForm(), []); const form = useMemo(() => createForm(), []);
return ( return (
<NodeContext.Provider value={{ type: node.type, config: values }}> <NodeContext.Provider value={{ ...node, config: values }}>
<VariableKeysContext.Provider value={keys}> <VariableKeysContext.Provider value={keys}>
<SchemaComponent <SchemaComponent
components={{ components={{
Alert, Alert,
TestFormFieldset,
}} }}
scope={{ scope={{
useCancelAction, useCancelAction,
@ -451,7 +449,7 @@ function TestButton() {
type: 'object', type: 'object',
title: '{{t("Replace variables", { ns: "workflow" })}}', title: '{{t("Replace variables", { ns: "workflow" })}}',
'x-decorator': 'FormItem', 'x-decorator': 'FormItem',
'x-component': TestFormFieldset, 'x-component': 'TestFormFieldset',
}, },
actions: { actions: {
type: 'void', type: 'void',