Skip to content

fix: handle invalid origin when navigating between pages#1856

Merged
gustavobtflores merged 1 commit intokernelci:mainfrom
gustavobtflores:fix/empty-origin-selector
Apr 16, 2026
Merged

fix: handle invalid origin when navigating between pages#1856
gustavobtflores merged 1 commit intokernelci:mainfrom
gustavobtflores:fix/empty-origin-selector

Conversation

@gustavobtflores
Copy link
Copy Markdown
Contributor

@gustavobtflores gustavobtflores commented Apr 15, 2026

Description

Fixes the origin selector appearing blank and causing empty backend responses when navigating between Hardware and Tree pages. The issue occurred because the origin search parameter is global, but Hardware pages use test_origins while Tree pages use checkout_origins. When a selected origin from one page type didn't exist in the other, the selector showed nothing and the backend returned no data.

Changes

  • Extract pageOrigins into a separate useMemo to compute page-specific origins
  • Update selectItems to use the pre-computed pageOrigins
  • Expand the origin validation useEffect to check if the current origin is invalid for the page and auto-correct to DEFAULT_ORIGIN

How to test

  1. Go to the Hardware page and select an origin that exists in test_origins but not in checkout_origins
  2. Navigate to the Trees page
  3. Verify the origin selector now shows a valid fallback origin instead of being blank
  4. Verify tree data loads correctly instead of showing empty results if there are results for the origin

Closes #1841

@gustavobtflores gustavobtflores self-assigned this Apr 15, 2026
@gustavobtflores gustavobtflores added the Frontend Most or all of the changes for this issue will be in the frontend code. label Apr 15, 2026
@gustavobtflores gustavobtflores force-pushed the fix/empty-origin-selector branch from 071ebe4 to dd53ad7 Compare April 15, 2026 12:48
Copy link
Copy Markdown
Collaborator

@MarceloRobert MarceloRobert left a comment

Choose a reason for hiding this comment

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

I see that the treeListing still makes a request with the invalid origin, so I think the best thing would be for the listings (tree and hardware) to check if the origin is valid before making the requests. But either way, a request to an invalid origin will be really fast, and this change ultimately fixes the problem so I'll approve and leave this as a technical debt

@gustavobtflores gustavobtflores added this pull request to the merge queue Apr 16, 2026
Merged via the queue into kernelci:main with commit 4dddee6 Apr 16, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Frontend Most or all of the changes for this issue will be in the frontend code.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Empty origin on Trees page when navigating from Hardware page

3 participants