Skip to content

fix(ui): persist follow-up prompt defaults#6126

Open
xsfX20 wants to merge 3 commits intoFlowiseAI:mainfrom
xsfX20:fix/follow-up-prompts-default-save-xsfx20
Open

fix(ui): persist follow-up prompt defaults#6126
xsfX20 wants to merge 3 commits intoFlowiseAI:mainfrom
xsfX20:fix/follow-up-prompts-default-save-xsfx20

Conversation

@xsfX20
Copy link
Copy Markdown

@xsfX20 xsfX20 commented Apr 2, 2026

Summary

  • persist provider default values when saving follow-up prompts so untouched prompt/temperature/base URL fields are still written
  • use the normalized provider values when checking required inputs so default-backed fields do not block save
  • fix the options input value lookup to read the selected option by key instead of the whole input descriptor

Testing

  • git diff --check
  • pnpm eslint packages/ui/src/ui-component/extended/FollowUpPrompts.jsx (fails locally because this checkout does not currently have the eslint binary installed)

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the FollowUpPrompts component by introducing helper functions to centralize configuration handling and default value logic, while also ensuring state synchronization after saving. Review feedback highlights a validation bug where the value 0 is incorrectly treated as invalid and suggests simplifying nullish checks using the == null idiom for improved readability.

followUpPromptsConfig[selectedProvider][param] === ''
) {
const value = getProviderInputValue(followUpPromptsConfig, selectedProvider, inputParam)
if (!value || value === '') {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

This check incorrectly treats 0 as an invalid value, which would disable the save button if a user sets a field like 'Temperature' to 0. Using value == null will correctly handle 0 as a valid input while still checking for null and undefined.

Suggested change
if (!value || value === '') {
if (value == null || value === '') {

const key = getProviderInputKey(inputParam)
const value = providerConfig[key]

return value !== undefined && value !== null && value !== '' ? value : inputParam.default
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The check for undefined and null can be simplified. Using loose equality (== null) checks for both null and undefined, which is a standard idiom in JavaScript and aligns with the general rules for this repository. This improves readability.

Suggested change
return value !== undefined && value !== null && value !== '' ? value : inputParam.default
return value != null && value !== '' ? value : inputParam.default
References
  1. In JavaScript/TypeScript, use loose equality (== null) as a standard idiom for a 'nullish' check that covers both null and undefined.

Comment on lines +335 to +337
if ((providerConfig[key] === undefined || providerConfig[key] === null || providerConfig[key] === '') && inputParam.default !== undefined) {
providerConfig[key] = inputParam.default
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The check for undefined and null can be simplified. Using loose equality (== null) checks for both null and undefined, which is a standard idiom in JavaScript and aligns with the general rules for this repository. This improves readability.

Suggested change
if ((providerConfig[key] === undefined || providerConfig[key] === null || providerConfig[key] === '') && inputParam.default !== undefined) {
providerConfig[key] = inputParam.default
}
if ((providerConfig[key] == null || providerConfig[key] === '') && inputParam.default !== undefined) {
providerConfig[key] = inputParam.default
}
References
  1. In JavaScript/TypeScript, use loose equality (== null) as a standard idiom for a 'nullish' check that covers both null and undefined.

@xsfX20
Copy link
Copy Markdown
Author

xsfX20 commented Apr 2, 2026

Addressed the validation issue from the review.

  • allow 0 to pass required-field validation for follow-up prompt settings
  • keep empty-string / null / undefined blocked as before

Pushed in 1843e519.

@xsfX20
Copy link
Copy Markdown
Author

xsfX20 commented Apr 2, 2026

Follow-up update: I pushed one more small cleanup in 48a0e372 to address the readability suggestion from the Gemini review as well.

  • keep the earlier 0 validation fix in place
  • simplify the repeated nullish checks to the == null idiom where we only want to treat null / undefined as missing

Scope is still intentionally narrow to the follow-up prompts config flow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant