Skip to content

fix(orchestrator-form-widgets): show spinner immediately on ActiveText retrigger#2279

Merged
mareklibra merged 6 commits intoredhat-developer:mainfrom
lokanandaprabhu:fix/active-text-retrigger-spinner
Feb 26, 2026
Merged

fix(orchestrator-form-widgets): show spinner immediately on ActiveText retrigger#2279
mareklibra merged 6 commits intoredhat-developer:mainfrom
lokanandaprabhu:fix/active-text-retrigger-spinner

Conversation

@lokanandaprabhu
Copy link
Member

@lokanandaprabhu lokanandaprabhu commented Feb 9, 2026

Hey, I just made a Pull Request!

Fixes:

https://issues.redhat.com/browse/RHDHBUGS-2594

PR description:

Problem

ActiveText widgets with fetch:retrigger (and no fetch:url) briefly show stale ui:text during the debounce window. The spinner only appears once evaluation starts, which is visible in production latency.

Solution

  • Start loading immediately when retrigger dependencies change (before debounce).
  • Keep spinner visible through fetch/evaluation completion.
  • Clear widget values on retrigger when fetch:clearOnRetrigger is enabled to avoid stale state during refetch.

Changes

  • useFetch: mark loading as soon as retrigger deps change and are satisfied.
  • useFetchAndEvaluate: mark loading immediately on retrigger change even without fetch.
  • Add fetch:clearOnRetrigger support for ActiveTextInput, ActiveDropdown, and ActiveMultiSelect.

✔️ Checklist

  • A changeset describing the change and affected packages. (more info)
  • Added or Updated documentation
  • Tests for new functionality and regression tests for bug fixes
  • Screenshots attached (for UI changes)

@rhdh-gh-app
Copy link

rhdh-gh-app bot commented Feb 9, 2026

Changed Packages

Package Name Package Path Changeset Bump Current Version
@red-hat-developer-hub/backstage-plugin-orchestrator-form-widgets workspaces/orchestrator/plugins/orchestrator-form-widgets patch v1.7.1

@lokanandaprabhu
Copy link
Member Author

/hold

@lokanandaprabhu
Copy link
Member Author

Test Spinner ActiveText:

Minimal workflow to validate ActiveText shows a spinner immediately when retrigger inputs change.
Uses a delayed fetch to make the debounce window visible and confirm the spinner stays until evaluation completes.

test-spinner-active-text.sw.yaml

id: test-spinner-active-text
version: "1.0"
specVersion: "0.8"
name: Test Spinner ActiveText
description: Simple workflow to test ActiveText spinner on retrigger
dataInputSchema: schemas/test-spinner-active-text__main-schema.json
start: LogState
functions:
  - name: logFunction
    type: custom
    operation: sysout
states:
  - name: LogState
    type: operation
    actions:
      - name: logMessage
        functionRef:
          refName: logFunction
          arguments:
            message: "Workflow started with input: ${.}"
    end: true

schemas/test-spinner-active-text__main-schema.json

{
  "$id": "classpath:/schemas/test-spinner-active-text__main-schema.json",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Test Spinner ActiveText",
  "type": "object",
  "properties": {
    "step1": {
      "type": "object",
      "title": "Step 1 - ActiveText Spinner",
      "properties": {
        "inputNamespace": {
          "title": "Namespace",
          "type": "string",
          "default": "",
          "ui:widget": "ActiveTextInput"
        },
        "inputCluster": {
          "title": "Cluster",
          "type": "string",
          "default": "",
          "ui:widget": "ActiveTextInput"
        },
        "exists": {
          "type": "string",
          "default": "false",
          "ui:hidden": true,
          "ui:props": {
            "fetch:method": "GET",
            "fetch:url": "http://localhost:18080/delay?ms=5000",
            "fetch:response:value": "$string(true)",
            "fetch:response:default": "false",
            "fetch:error:ignoreUnready": true,
            "fetch:retrigger": [
              "current.step1.inputNamespace",
              "current.step1.inputCluster"
            ]
          },
          "ui:widget": "ActiveTextInput"
        },
        "existsMessage": {
          "type": "string",
          "ui:widget": "ActiveText",
          "ui:props": {
            "ui:text": "## The namespace \"$${{current.step1.inputNamespace}}\" does not exist on cluster \"$${{current.step1.inputCluster}}\"",
            "fetch:method": "GET",
            "fetch:url": "http://localhost:18080/delay?ms=5000",
            "fetch:retrigger": [
              "current.step1.inputNamespace",
              "current.step1.inputCluster"
            ]
          }
        }
      },
      "required": ["inputNamespace", "inputCluster"]
    }
  }
}

@lokanandaprabhu
Copy link
Member Author

Test Spinner ActiveDropdown

Static dropdown to trigger ActiveText fetch on selection change without dropdown fetching.
Confirms the ActiveText spinner appears instantly on dropdown change and persists until the delayed fetch resolves.

test-spinner-active-dropdown.sw.yaml

id: test-spinner-active-dropdown
version: "1.0"
specVersion: "0.8"
name: Test Spinner ActiveDropdown
description: Simple workflow to test ActiveDropdown spinner on retrigger
dataInputSchema: schemas/test-spinner-active-dropdown__main-schema.json
start: LogState
functions:
  - name: logFunction
    type: custom
    operation: sysout
states:
  - name: LogState
    type: operation
    actions:
      - name: logMessage
        functionRef:
          refName: logFunction
          arguments:
            message: "Workflow started with input: ${.}"
    end: true

schemas/test-spinner-active-dropdown__main-schema.json

{
  "$id": "classpath:/schemas/test-spinner-active-dropdown__main-schema.json",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Test Spinner ActiveDropdown",
  "type": "object",
  "properties": {
    "step1": {
      "type": "object",
      "title": "Step 1 - ActiveDropdown Spinner",
      "properties": {
        "dropdown": {
          "type": "string",
          "title": "Dropdown (Static)",
          "description": "Change this to retrigger the ActiveText fetch.",
          "enum": ["Option A", "Option B", "Option C"],
          "default": "Option A"
        },
        "dropdownMessage": {
          "type": "string",
          "title": "Dropdown Message",
          "ui:widget": "ActiveText",
          "ui:props": {
            "ui:text": "Selected option: \"$${{current.step1.dropdown}}\"",
            "fetch:method": "GET",
            "fetch:url": "http://localhost:18080/delay?ms=5000",
            "fetch:retrigger": ["current.step1.dropdown"]
          }
        }
      }
    }
  }
}

@lokanandaprabhu
Copy link
Member Author

Orchestrator - ActiveDropdown spinner
Orchestrator-active text spinner

lokanandaprabhu and others added 6 commits February 25, 2026 16:13
Co-authored-by: Cursor <cursoragent@cursor.com>
Document the new fetch:clearOnRetrigger behavior in the existing
changeset for the ActiveText retrigger spinner update.

Co-authored-by: Cursor <cursoragent@cursor.com>
Extract shared clear-on-retrigger behavior into a reusable hook and
reuse it across ActiveTextInput, ActiveDropdown, and ActiveMultiSelect.

Co-authored-by: Cursor <cursoragent@cursor.com>
Ignore stale fetch responses when retrigger values change and
avoid reapplying cached data while a retriggered fetch is loading.
Use layout effect for clearOnRetrigger to reduce UI flicker.

Co-authored-by: Cursor <cursoragent@cursor.com>
@lokanandaprabhu lokanandaprabhu force-pushed the fix/active-text-retrigger-spinner branch from 53c8e9d to 2d96cc0 Compare February 25, 2026 10:47
@sonarqubecloud
Copy link

@lokanandaprabhu
Copy link
Member Author

------BEFORE-------

Screen.Recording.2026-02-25.at.4.09.52.PM.mov

--------AFTER------

Screen.Recording.2026-02-25.at.3.47.11.PM.mov

@lokanandaprabhu
Copy link
Member Author

/unhold

@mareklibra
Copy link
Member

Thanks, it was tricky issue. It's good that this behavior is left to be optional, there are cases where the old flow makes sense.

@mareklibra mareklibra merged commit d6dff3b into redhat-developer:main Feb 26, 2026
9 checks passed
@lokanandaprabhu
Copy link
Member Author

/cherrypick orchestrator-1.8

@openshift-cherrypick-robot

@lokanandaprabhu: #2279 failed to apply on top of branch "orchestrator-1.8":

Applying: fix: show spinner on ActiveText retrigger
Using index info to reconstruct a base tree...
M	workspaces/orchestrator/plugins/orchestrator-form-widgets/src/utils/useFetch.ts
M	workspaces/orchestrator/plugins/orchestrator-form-widgets/src/utils/useFetchAndEvaluate.ts
Falling back to patching base and 3-way merge...
Auto-merging workspaces/orchestrator/plugins/orchestrator-form-widgets/src/utils/useFetchAndEvaluate.ts
Auto-merging workspaces/orchestrator/plugins/orchestrator-form-widgets/src/utils/useFetch.ts
CONFLICT (content): Merge conflict in workspaces/orchestrator/plugins/orchestrator-form-widgets/src/utils/useFetch.ts
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0001 fix: show spinner on ActiveText retrigger

Details

In response to this:

/cherrypick orchestrator-1.8

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants