VolkovLabs/business-forms

How to migrate dynamic custom select options on panels from v3.2.1 to >3.4.0

Closed this issue · 1 comments

Hi, i have a problem with dynamic custom select options on panel when i try to update from v3.2.1 to v3.4.0 version (and up to 3.6.0).

Testing Issue:

The testing issue is a empty data manipulation panel with 1 form panel (type: "Select With Custom Options") with empty options. On initial Request custom code i write the next code which push 4 custom options to the form panel:

console.clear();

elements[0].options = [];
onChange(elements)

const selectorOptions = [
  "a", "b", "c", "d"
]

selectorOptions.forEach((option) => {
  elements[0].options.push(
    {
      id: option,
      label: option,
      type: "string",
      value: "a"
    }
  )
});

onChange(elements)

v3.2.1 output:

Output is the expected:

v3.2.1

v3.4 (and newer) output:

Output is empty:
v3.4.0

Thanks in advance for your time!

@daguirrem working example for your case

console.clear();

context.panel.elements[0].options = [];

const selectorOptions = [
  "a", "b", "c", "d"
]

selectorOptions.forEach((option) => {
  context.panel.elements[0].options.push(
    {
      id: option,
      label: option,
      type: "string",
      value: "a"
    }
  )
});

context.panel.onOptionsChange({
  ...context.panel.options,
  elements,
})

Please let us know if there is anything else