Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ui/src/workflow-canvas/nodes/start-node/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function getRefreshFieldList() {
value: field.field ?? field.variable,
}))
const apiFields = (cloneDeep(baseNode?.properties.api_input_field_list ?? []) as SourceField[]).map((field: SourceField) => ({
label: field.name ?? field.variable,
label: field.name || field.variable,
value: field.variable,
}))
return [...userFields, ...apiFields]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No syntax issues in the diff. The main concern is a semantic change: ?? → ||.

Potential issues

  1. Behavior change with falsy values

    • Before: field.name ?? field.variable
      • Falls back only when field.name is null or undefined.
    • After: field.name || field.variable
      • Falls back for any falsy value: "", 0, false, NaN, null, undefined.
    • If field.name is an empty string and you want to show it as an intentional empty label, || will incorrectly replace it.
    • If field.name can only be a non-empty string or null/undefined, the change has no practical effect.
  2. Inconsistency with userFields

    • userFields still uses:
      label: field.field ?? field.variable
    • apiFields now uses:
      label: field.name || field.variable
    • If the fallback rules should be the same, this inconsistency may cause different labels for equivalent missing/empty values.
  3. Possible unintended behavior for whitespace-only names

    • field.name || field.variable does not fall back for " ".
    • If API data may contain whitespace-only names, consider trimming.

Suggested fix

If the goal is only to handle null / undefined, keep ??:

label: field.name ?? field.variable,

If the goal is to also fall back for empty strings, make it explicit and consistent:

label: field.name?.trim() ? field.name : field.variable,

Or, if both fields should behave identically:

const getLabel = (name?: string | null, variable?: string) =>
  name?.trim() ? name : variable ?? ''

Summary

  • || is not wrong syntactically, but it is broader than ??.
  • Main risk: empty string or other falsy values now trigger fallback.
  • Main suggestion: align userFields and apiFields logic, and use an explicit empty-string check if that is the intended behavior.

Expand Down
Loading