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
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const exposedInputTypes = ['TextInput', 'TextareaInput', 'PasswordInput', 'SingleSelect', 'MultiSelect', 'DatePicker', 'SwitchInput','Model',"Knowledge"]
export const exposedInputTypes = ['TextInput', 'TextareaInput', 'PasswordInput', 'SingleSelect', 'MultiSelect', 'DatePicker', 'SwitchInput','Model',"Knowledge","TreeSelect"]

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.

Verdict

The change is functionally harmless — it just appends a string to an array. No syntax errors. The concerns are stylistic and about type-safety/maintainability rather than bugs.

Issues & Suggestions

1. Inconsistent quoting
"Model" and "Knowledge" use double quotes while everything else uses single quotes (and "TreeSelect" follows the same wrong pattern). If Prettier/ESLint with singleQuote is in the project, this should fail lint or be auto-fixed. Keep it consistent:

export const exposedInputTypes = ['TextInput', 'TextareaInput', 'PasswordInput', 'SingleSelect', 'MultiSelect', 'DatePicker', 'SwitchInput', 'Model', 'Knowledge', 'TreeSelect'];

2. No literal typing (as const / satisfies)
As written, this infers string[], so a typo like 'TreeSelct' compiles fine and consumers can't narrow on it. Prefer:

export const exposedInputTypes = [
  'TextInput', /* ... */, 'TreeSelect',
] as const satisfies readonly string[];

export type ExposedInputType = typeof exposedInputTypes[number];

This gives autocomplete and compile-time safety at every includes(...) / switch site.

3. Single source of truth
The list mixes naming conventions (TextInput, DatePicker, Model, Knowledge, TreeSelect). Consider a shared enum/const object in one module (ideally shared with the backend allowlist), so the frontend list, backend validation, and component registry can't drift apart.

4. Mutable export
export const doesn't prevent push()/mutation by consumers. If it's meant to be a static allowlist, use as const, Object.freeze([...]), or readonly string[].

5. Line length
The single line is now ~170+ chars; will trip max-len rules. Split across lines for readability.

Functional Checklist Before Merging

  • TreeSelect component is actually exported/registered in whatever component map consumes exposedInputTypes (otherwise it renders nothing / throws).
  • Backend / API allowlist, validation schema (Zod/Yup), and serializers accept "TreeSelect".
  • If this array gates rendering or permissions, confirm exposing TreeSelect is intended for all roles that read this list.
  • i18n keys, form-builder UI catalog, and docs updated.
  • Tests/snapshots that assert the exact length or contents of exposedInputTypes updated.
  • Case-sensitivity: consumers match on exact string — verify no legacy "treeselect" usage exists.

Performance (minor)

  • If exposedInputTypes.includes(type) is called in a hot render path, convert to a Set for O(1) lookup. For a 10-item list it's negligible, but it's a cheap win.
  • Array size growth is irrelevant here.

Bottom line

Ship-blocking: none. Recommended: fix quoting, add as const/typed union, and verify TreeSelect is wired up end-to-end (component + backend allowlist + tests).

Loading