Skip to content

fix(server): trim show community nodes env#6143

Open
suyua9 wants to merge 2 commits intoFlowiseAI:mainfrom
suyua9:bugfix/show-community-nodes-whitespace-suyua9
Open

fix(server): trim show community nodes env#6143
suyua9 wants to merge 2 commits intoFlowiseAI:mainfrom
suyua9:bugfix/show-community-nodes-whitespace-suyua9

Conversation

@suyua9
Copy link
Copy Markdown

@suyua9 suyua9 commented Apr 3, 2026

Summary

  • trim SHOW_COMMUNITY_NODES before parsing it as a boolean
  • keep the existing default-disabled behavior when the env var is unset
  • add a regression test covering whitespace-padded true/false values

Testing

  • git diff --check -- packages/server/src/AppConfig.ts packages/server/src/AppConfig.test.ts
  • pnpm --dir /Users/ming/code/Flowise/packages/server test -- --runInBand src/AppConfig.test.ts (fails in this checkout because packages/server/node_modules is missing and jest is not installed locally)

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 introduces a parseBooleanEnv helper function to standardize environment variable parsing, specifically handling whitespace trimming and case-insensitive boolean checks. It also adds comprehensive unit tests for these scenarios. The review feedback suggests using a loose equality check (== null) in the helper function to more robustly handle both null and undefined values, which is a common idiom in TypeScript.

Comment on lines +2 to +4
if (value === undefined) {
return defaultValue
}
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

According to the project's general rules, loose equality (== null) should be used as a standard idiom for nullish checks to cover both null and undefined. This is more idiomatic in this codebase and also makes the helper function more robust if it's ever used with values that could be null.

Suggested change
if (value === undefined) {
return defaultValue
}
if (value == null) {
return defaultValue
}
References
  1. In JavaScript/TypeScript, use loose equality (== null) as a standard idiom for a 'nullish' check that covers both null and undefined.

@suyua9
Copy link
Copy Markdown
Author

suyua9 commented Apr 3, 2026

Addressing the Gemini follow-up in the existing PR branch.

  • switched the helper guard to value == null so it covers nullish env values explicitly while keeping the same default-disabled behavior
  • no behavior change for trimmed true/false strings; this is just the narrower nullish guard the review suggested

Local validation in this checkout is still limited to git diff --check because packages/server/node_modules is missing, so jest is not installed locally here.

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