Skip to content

fix(RHINENG-26827): pathway details systems table fixes - #2065

Merged
brantleyr merged 4 commits into
RedHatInsights:foreman-pathways-dev-v2from
Fewwy:pathway-details-fixes
Jul 16, 2026
Merged

fix(RHINENG-26827): pathway details systems table fixes#2065
brantleyr merged 4 commits into
RedHatInsights:foreman-pathways-dev-v2from
Fewwy:pathway-details-fixes

Conversation

@Fewwy

@Fewwy Fewwy commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Description

https://redhat.atlassian.net/browse/RHINENG-26827

Removed the table that was using hybridinventory
Fixed missing props pass

Replace the IOP-specific pathway systems table with the standard Inventory-based pathway systems component and align axios usage for IOP endpoints.

Bug Fixes:

  • Ensure the IopRemediationModal is passed through to the pathway systems Inventory table so remediation works correctly.
  • Selecting a row in system tables in recommendation details and pathway details would cause freeze of UI
  • Remediate button wasn't accessible
  • Remediating pathways required a different mapping for pathways
  • Downloading playbook wasn't working correctly
  • A bunch of small issues with inventory table triggering re-render when data in the table changed

Enhancements:

  1. Simplify pathway systems rendering by reusing the shared PathwaySystems component instead of a separate IopPathwaySystems implementation.

  2. Add a response interceptor to the IOP axios instance to normalize responses to their data payload.

  3. ASYNC_COMPONENT_FALLBACK — module-level constant
    Fix for the Freeze after selecting a row - Scalprum's shouldComponentUpdate uses lodash/isEqual on all props. Without this, AsyncComponent creates a new fallback element every render. isEqual hits _owner (a FiberNode) on those elements and traverses the entire React Fiber tree → 14-second freeze. A stable reference makes isEqual short-circuit with ===.

  4. shallowEqual on entities useSelector
    Original: useSelector(({ entities }) => entities || {}) — returns a new {} reference whenever any Redux state changes, triggering unnecessary re-renders. shallowEqual prevents re-renders when entities properties haven't actually changed.

  5. safeSelectedIds = useMemo(() => selectedIds || [], [selectedIds])
    useSelectionManager returns undefined when the last item is deselected (deletes the default key). Without normalization, every consumer needs selectedIds?.length guards. This gives a stable [] reference.

  6. selectedIdsRef + useRef
    Allows fetchSystems to read the current selectedIds without including it in useMemo deps. Without this, fetchSystems recreates on every selection change, triggering a full data refetch.

  7. fetchSystems wrapped in useMemo
    Original: getEntities(...) called directly — creates a new function every render, passed as getEntities prop to the inventory table, causing a full refetch on every render. Now only recreates when pathway, rule, or API URLs change.

  8. setResolutions([]) in the else branch of resolutions useEffect
    Clears stale resolution data on deselect. Without this, resolutions keeps data from the previous selection, making actionsConfig contain large data structures that increase render cost on deselect.

  9. Resolutions useEffect expanded for pathway case
    Original only handled the rule case. Pathway systems need their own resolution mapping for IopRemediationModal to work on pathway detail pages.

  10. actionsConfig wrapped in useMemo (was getActionsConfig() called inline)
    Original: called in JSX → new object every render. Now only recomputes when its actual inputs change.

  11. checkRemediationButtonStatus refactored
    Original had a bug: pathwayRulesList.find((report) => (report.rule_id = assosciatedRule)) — uses = (assignment) instead of === (comparison), corrupting data. Rewritten with correct logic.

  12. pathwayRulesList initial state changed from {} to []
    It's used as an array (.find(), .forEach()). Initializing as {} would throw on array methods.

  13. onLoadHandler wrapped in use
    Original: inline arrow function in JSX → new function every render → passed through isEqual deep comparison. Now stable reference

  14. chromelessTableProps / standemo
    Original: inline tableProps={{...}} → new object every render → forces isEqual to deep-compare. Now stable reference

  15. chromelessCustomFilters / stn useMemo
    Same reason — inline objects created new references every render.

  16. chromelessExportConfig / standardExportConfig wrapped in useMemo
    Same reason — inline objects with new arrow functions every render.

  17. CHROMELESS_HIDE_FILTERS / STlevel constants
    Original: inline objects in JSX → new references every render. As constants, isEqual short-circuits with ===.

  18. columns={createColumns} instns) =>createColumns(defaultColumns)}
    Original wraps in an unnecessary arrow function → new reference every render. createColumns is already a useCallback, so pass it directly.

  19. showTags={false} instead of showTags={envContext.loadChromeless ? false : showTags}
    In the chromeless branch, envContext.loadChromeless is always true, so this always evaluates to false. Simplified.

  20. All selectedIds references → safeSelectedIds
    Consistent use of the normalized value to avoid undefined guards scattered throughout.

@Fewwy
Fewwy requested a review from a team as a code owner July 14, 2026 16:58
@sourcery-ai

sourcery-ai Bot commented Jul 14, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Refactors pathway systems rendering to use the standard PathwaySystems inventory component instead of a separate Iop-specific variant, and ensures axios response handling and remediation modal props are correctly wired in the pathway details flow.

Sequence diagram for pathway systems rendering with remediation modal

sequenceDiagram
  actor User
  participant PathwayDetails as PathwayDetails
  participant PathwaySystems as PathwaySystems
  participant Inventory as Inventory

  User->>PathwayDetails: view pathway details
  PathwayDetails->>PathwaySystems: render PathwaySystems(pathway, selectedTags, workloads, axios, IopRemediationModal)
  PathwaySystems->>Inventory: render Inventory(tableProps, onLoad, customFilters, selectedTags, workloads, axios, IopRemediationModal)
  Inventory-->>User: display systems table with remediation modal
Loading

Sequence diagram for iopAxios response data interception

sequenceDiagram
  participant Component as PathwayDetailsWrapped
  participant iopAxios as iopAxios
  participant Backend as insights_cloud_api
  participant Interceptor as responseDataInterceptor

  Component->>iopAxios: iopAxios.get(path)
  iopAxios->>Backend: HTTP GET /insights_cloud/path
  Backend-->>iopAxios: response
  iopAxios->>Interceptor: response
  Interceptor-->>Component: response.data
Loading

File-Level Changes

Change Details Files
Use the shared PathwaySystems inventory component for pathway systems instead of the Iop-specific implementation.
  • Removed the dedicated IopPathwaySystems component file
  • Updated lazy import to load PathwaySystems from the conventional systems directory
  • Adjusted the Suspense block to render PathwaySystems in the chromeless view instead of IopPathwaySystems
src/SmartComponents/Recs/DetailsPathways.js
src/SmartComponents/HybridInventoryTabs/ConventionalSystems/IopPathwaySystems.js
Pass remediation modal and axios correctly into the PathwaySystems inventory component.
  • Extended PathwaySystems component signature to accept the IopRemediationModal prop
  • Forwarded IopRemediationModal to the underlying Inventory component
  • Declared PropTypes for IopRemediationModal
  • Ensured IopRemediationModal and axios are passed from PathwayDetails to PathwaySystems
src/SmartComponents/HybridInventoryTabs/ConventionalSystems/PathwaySystems.js
src/SmartComponents/Recs/DetailsPathways.js
Normalize axios responses for the IOP pathway details flow via a response interceptor.
  • Added a responseDataInterceptor helper that unwraps response.data when present
  • Registered the interceptor on the iopAxios instance so pathway details consumers receive plain data objects
src/SmartComponents/Recs/PathwayDetailsWrapped.js

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

This comment was marked as low quality.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • If IopRemediationModal is intended to be a component type passed through to Inventory rather than a rendered element instance, consider changing its PropType from PropTypes.element to PropTypes.elementType (or node if it can also be plain content) to better match how it’s used.
  • The responseDataInterceptor changes the shape of all successful iopAxios responses to response.data; double-check all current callers of iopAxios are expecting this and don’t rely on status, headers, or other response metadata.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- If `IopRemediationModal` is intended to be a component type passed through to `Inventory` rather than a rendered element instance, consider changing its PropType from `PropTypes.element` to `PropTypes.elementType` (or `node` if it can also be plain content) to better match how it’s used.
- The `responseDataInterceptor` changes the shape of all successful `iopAxios` responses to `response.data`; double-check all current callers of `iopAxios` are expecting this and don’t rely on `status`, `headers`, or other response metadata.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@Fewwy Fewwy changed the title fix(iop): pathway details systems table fixes fix(RHINENG-26827): pathway details systems table fixes Jul 15, 2026
@Fewwy Fewwy self-assigned this Jul 15, 2026
@brantleyr

Copy link
Copy Markdown
Collaborator

/retest

@brantleyr
brantleyr merged commit 06c95a1 into RedHatInsights:foreman-pathways-dev-v2 Jul 16, 2026
2 of 3 checks passed
Fewwy added a commit to Fewwy/insights-advisor-frontend that referenced this pull request Jul 23, 2026
…ts#2065)

* fix(iop): pathway details systems table fixes
* fix(iop): add guardrail for remediations modal
* fix(RHINENG-26827): improve inventory table and bugfixes for pathways
* fix(RHINENG-26827): tooltips when for no remediation or playbook
Fewwy added a commit that referenced this pull request Jul 28, 2026
* fix(RHINENG-28040): fix freezing bug and update inventory table (#2072)

* chore(deps): update build-tools digest to a55d220 (#2066)

Signed-off-by: red-hat-konflux <126015336+red-hat-konflux[bot]@users.noreply.github.com>
Co-authored-by: red-hat-konflux[bot] <126015336+red-hat-konflux[bot]@users.noreply.github.com>

* chore(deps): update dependency github.com/redhatinsights/konflux-pipelines to v1.70.0 (#2058)

Signed-off-by: red-hat-konflux <126015336+red-hat-konflux[bot]@users.noreply.github.com>
Co-authored-by: red-hat-konflux[bot] <126015336+red-hat-konflux[bot]@users.noreply.github.com>

* chore(deps): override sanitize-html (#2082)

* fix(iop): bypass federated IOPInventoryTable for Pathways Systems tab

The Pathways detail Systems tab crashed in Foreman with "Error loading
component" because the federated IOPInventoryTable requires React 18
and RRDv6, but Foreman runs React 16 and RRDv5. Replace it with a
standalone PF5 composable table (IopPathwaySystems) that fetches
systems directly via the API when loadChromeless is true.

* fix(RHINENG-26827): pathway details systems table fixes (#2065)

* fix(iop): pathway details systems table fixes
* fix(iop): add guardrail for remediations modal
* fix(RHINENG-26827): improve inventory table and bugfixes for pathways
* fix(RHINENG-26827): tooltips when for no remediation or playbook

* fix(iop): fixed pathway details system table host links

---------

Signed-off-by: red-hat-konflux <126015336+red-hat-konflux[bot]@users.noreply.github.com>
Co-authored-by: red-hat-konflux[bot] <126015336+red-hat-konflux[bot]@users.noreply.github.com>
Co-authored-by: Viliam Krizan <vkrizan@redhat.com>
Co-authored-by: Richard Brantley <brantleyr@gmail.com>
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.

2 participants