Skip to content

Commit 3128cb4

Browse files
committed
feat: enhance fallback handling in FunctionFileDefaultComponent and FunctionFileTriggerComponent
1 parent e1a215c commit 3128cb4

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

src/packages/ce/src/function/components/files/FunctionFileDefaultComponent.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {FunctionService} from "@edition/function/services/Function.service";
1313
import {FlowService} from "@edition/flow/services/Flow.service";
1414
import {DataTypeInputComponent} from "@edition/datatype/components/inputs/DataTypeInputComponent";
1515
import {
16+
FALLBACK_FUNCTION_DESCRIPTION, FALLBACK_FUNCTION_NAME,
1617
FALLBACK_FUNCTION_PARAMETER_DESCRIPTION,
1718
FALLBACK_FUNCTION_PARAMETER_NAME
1819
} from "@core/util/fallback-translations";
@@ -128,9 +129,9 @@ export const FunctionFileDefaultComponent: React.FC<FunctionFileDefaultComponent
128129
}, [validation])
129130

130131
return <>
131-
<Text size={"md"}>{definition?.names?.[0].content}</Text>
132+
<Text size={"md"}>{definition?.names?.[0]?.content ?? FALLBACK_FUNCTION_NAME}</Text>
132133
<Spacing spacing={"xs"}/>
133-
<Text hierarchy={"tertiary"}>{definition?.descriptions?.[0].content}</Text>
134+
<Text hierarchy={"tertiary"}>{definition?.descriptions?.[0]?.content ?? FALLBACK_FUNCTION_DESCRIPTION}</Text>
134135
{
135136
nodeValidation && <>
136137
<Spacing spacing={"xl"}/>

src/packages/ce/src/function/components/files/FunctionFileTriggerComponent.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import {DataTypeInputComponent} from "@edition/datatype/components/inputs/DataTy
88
import {getTypesFromFunction} from "@code0-tech/triangulum";
99
import {DataTypeTypeInputComponent} from "@edition/datatype/components/inputs/datatype/DataTypeTypeInputComponent";
1010
import {
11+
FALLBACK_FLOW_TYPE_DESCRIPTION,
12+
FALLBACK_FLOW_TYPE_NAME,
1113
FALLBACK_FLOW_TYPE_SETTING_DESCRIPTION,
1214
FALLBACK_FLOW_TYPE_SETTING_NAME
1315
} from "@core/util/fallback-translations";
@@ -102,9 +104,9 @@ export const FunctionFileTriggerComponent: React.FC<FunctionFileTriggerComponent
102104
}, [validation])
103105

104106
return <>
105-
<Text size={"md"}>{definition?.names?.[0].content}</Text>
107+
<Text size={"md"}>{definition?.names?.[0]?.content ?? FALLBACK_FLOW_TYPE_NAME}</Text>
106108
<Spacing spacing={"xs"}/>
107-
<Text hierarchy={"tertiary"}>{definition?.descriptions?.[0].content}</Text>
109+
<Text hierarchy={"tertiary"}>{definition?.descriptions?.[0]?.content ?? FALLBACK_FLOW_TYPE_DESCRIPTION}</Text>
108110
{
109111
triggerValidation && <>
110112
<Spacing spacing={"xl"}/>

0 commit comments

Comments
 (0)