Skip to content

fix(frontend): RI exchange reshape empty state can show a stale RI count #1135

Open

Description

@cristim

Summary

On the RI Exchange page, the reshape-recommendations empty state can show a stale convertible-RI count.

Evidence (origin/main d9b2aa7)

  • loadRIExchange (frontend/src/riexchange.ts:100-146) starts loadConvertibleRIs, loadReshapeRecommendations and loadExchangeHistory in parallel.
  • renderRecommendations (~:1325) builds the "All N convertible RIs meet your utilization threshold" copy from currentRIs.length.
  • If the recommendations response arrives first and is empty, the copy uses the previous currentRIs (or none). Nothing re-renders it once loadConvertibleRIs updates currentRIs.

This race exists on every loadRIExchange call, including the initial page load. #285 (PR #1126) makes the post-exchange refresh go through loadRIExchange, so it is also reachable after an exchange.

Proposed fix

After the AWS Promise.all in loadRIExchange (same generation), re-render the reshape empty state when the recommendations load succeeded and returned no rows. Keep an error message from a failed recommendations load. Add a jest test that resolves recommendations before RIs and asserts the final count.

Found by CodeRabbit on PR #1126.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions