Skip to content

🐛 Bug Report: Using conditional option in scaffolder template might cause stale data #27872

Open
@kmikko

Description

📜 Description

I'm re-reporting issue from #12948 which was fixed but then reverted in #27317 as it still occurs with latest version of Backstage.

Shortly: Selecting conditional option doesn't properly reset values depending on another condition.

Minimal reproducible example:

parameters:
  - title: Fill in some steps
    properties:
      condition:
        type: string
        enum:
          - A
          - B
        ui:widget: radio
        ui:options:
          inline: true
    dependencies:
      condition:
        allOf:
          - if:
              properties:
                condition:
                  const: A
            then:
              properties:
                extraOption:
                  title: Extra option for A
                  type: string

👍 Expected behavior

Value of conditional field extraOption which depends on A should reset after selecting option B.

👎 Actual Behavior with Screenshots

Value of extraOption doesn't reset after option B is selected.

Screen.Recording.2024-11-27.at.13.40.57.mov

👟 Reproduction steps

  • Open Template Editor and paste in example from description.
  • Select A as condition
  • Fill in any value to extraOption
  • Select B as condition
  • Proceed to Review
  • Value for extraOption is preserved even though B is selected as condition

📃 Provide the context for the Bug.

No response

🖥️ Your Environment

No response

👀 Have you spent some time to check if this bug has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Are you willing to submit PR?

No, but I'm happy to collaborate on a PR with someone else

Metadata

Assignees

No one assigned

    Labels

    area:scaffolderEverything and all things related to the scaffolder project areabugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions