Draft: #3587711 fix: code component exceptions after prop type change

When a Js code component's prop type changes between saves (eg. string -> integer), any existing page instances crashes with an exception on the next edit. The reason is because JsComponent was using GeneratedFieldExplicitInputUxComponentInstanceUpdater, which blocks updates whenever a prop's storage type changes, making the component->validateProps to fail.

Fix: Introduce a new JsComponentInstanceUpdater for Code Components to allow shape changes and data loss.

Steps to test

  • Create a JS code component with a required string prop (required_text) and an optional string prop (optional_text).
  • Add the component to a page. Set values for both inputs.
  • Right click on the component, Edit code and then "Remove from components"
  • Edit the component: change required_text type from string to integer. Save.
  • Navigate back to the page and open it for editing.
    • Verify no exception is thrown.
    • Verify required_text is reset to the default value (data loss accepted).
    • Verify optional_text (type unchanged) still holds its original value.
  • Repeat with a type change that forces an enum field (e.g. add enum to make it list_string) — verify the default enum value is injected for the required prop.

Closes #3587711

Edited by Ignacio Sánchez Holgueras

Merge request reports

Loading