Skip to content

Custom Select: No Selection of Options if onOptionSelected is not set #4186

@db-gspeck

Description

@db-gspeck

Which generators are impacted?

  • All
  • HTML
  • React
  • Angular
  • Vue
  • Web components
  • Power Apps

Reproduction case

Broken:

<DBCustomSelect
      multiple
      formFieldWidth={"auto"}
      className={"" + (className ?? "")}
      label="Label"
      options={[{value: 'option1'}, {value: 'option2'}, ]}
   />

Works:
Broken:

<DBCustomSelect
      multiple
      formFieldWidth={"auto"}
      className={"" + (className ?? "")}
      label="Label"
      options={[{value: 'option1'}, {value: 'option2'}, ]}
      onOptionSelected={() => {}}
   />

Expected Behaviour

Options should be selectable

Screenshots

No response

Browser version

None

Add any other context about the problem here.

handleOptionSelected: (values: string[]) => {
const skip =
new Date().getTime() - state._internalChangeTimestamp < 200;
if (skip) return;
if (props.onOptionSelected) {
state._values = values;
props.onOptionSelected(values ?? []);
}
useTarget({
angular: () =>
handleFrameworkEventAngular(
state,
{
target: { values }
},
'values'
),
vue: () =>
handleFrameworkEventVue(
() => {},
{
target: { values }
},
'values'
)
});
state._internalChangeTimestamp = new Date().getTime();
},

here we have the following possible issues:

  1. the value is in state set only when onOptionSelected is defined (Line 368)
  2. in useTarget react isn't defined (Line 373)

Metadata

Metadata

Assignees

Type

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions