Skip to content

Bug: Target infrastructure reference field renders empty during Chaos Experiment edit mode #5581

Description

@Kayd-06

Summary

When a user edits an existing Chaos Experiment (StudioOverview / ChaosInfrastructureReferenceField), the pre-selected target Kubernetes Chaos Infrastructure field renders empty if the target infrastructure is not located on the first page of the paginated listInfras GraphQL query results.

Steps to Reproduce

  1. Navigate to a project in Litmus Chaos Center.
  2. Ensure there are multiple target Chaos Infrastructures (or change pagination limits/search filters such that a specific infrastructure is not on page 1).
  3. Create a Chaos Experiment utilizing that specific target infrastructure.
  4. Open the experiment in Edit Mode (StudioOverview).
  5. Observe the Target Infrastructure reference field.

Expected Behavior

The target infrastructure field should correctly display the pre-selected infrastructure (initialInfrastructureID) regardless of whether it appears on the current page of the paginated list query.

Actual Behavior

The target infrastructure reference field appears completely empty during edit mode, as noted by the existing TODO in codebase:
// TODO: replace with get API as this becomes empty during edit inside KubernetesChaosInfrastructureReferenceField.tsx.

Root Cause

KubernetesChaosInfrastructureReferenceFieldController previously attempted to find the initial infrastructure solely by searching within listChaosInfraData?.listInfras.infras.find(). Because listChaosInfra is paginated (page: 0, limit: 5), any infrastructure not present in the current page slice causes .find() to return undefined.

Proposed Solution

Fetch the specific infrastructure details directly by ID using the backend's getInfraDetails(projectID: $projectID, infraID: $infraID) GraphQL query whenever initialInfrastructureID is provided, and fallback/merge with the paginated list results.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions