Skip to content

TRT-2764: Sippy tests page: search bar does not complete search until page is refreshed#3721

Open
openshift-trt-agent[bot] wants to merge 4 commits into
openshift:mainfrom
openshift-trt:trt-2764
Open

TRT-2764: Sippy tests page: search bar does not complete search until page is refreshed#3721
openshift-trt-agent[bot] wants to merge 4 commits into
openshift:mainfrom
openshift-trt:trt-2764

Conversation

@openshift-trt-agent

Copy link
Copy Markdown

Summary

Fixes the search bar on table pages (Tests, Jobs, etc.) not completing searches after pressing Enter. The URL would update with the search terms, but the table stayed in a loading/spinner state indefinitely. A manual page refresh was required to see results.

Root cause: The requestSearch function in all 11 table components mutated the filterModel object in-place (const currentFilters = filterModel) before passing the same reference to setFilterModel. This broke compatibility with the useStableJSONQueryParam hook (introduced in PR #3711), which stabilizes object references to prevent duplicate API calls. Because the hook's internal ref was mutated in-place, it could not detect that the value had changed, so the useEffect that triggers fetchData would not fire.

Fix: Create a new object in requestSearch instead of mutating the existing filterModel, matching the immutable pattern already used by the addFilters function in these same components.

Files changed (11 table components):

  • sippy-ng/src/tests/TestTable.js
  • sippy-ng/src/tests/FeatureGates.js
  • sippy-ng/src/jobs/JobTable.js
  • sippy-ng/src/jobs/JobRunsTable.js
  • sippy-ng/src/releases/PayloadStreamTestFailures.js
  • sippy-ng/src/releases/PayloadStreamsTable.js
  • sippy-ng/src/releases/PayloadTestFailures.js
  • sippy-ng/src/releases/ReleasePayloadJobRuns.js
  • sippy-ng/src/releases/ReleasePayloadPullRequests.js
  • sippy-ng/src/releases/ReleasePayloadTable.js
  • sippy-ng/src/repositories/RepositoriesTable.js

Screenshots

Before search (all tests loaded):

Tests page before search

After searching "etcd" (results filtered immediately, no page refresh):

Tests page after search for etcd

Test plan

  • make lint passes
  • make test passes (Go unit tests + Jest tests)
  • E2e tests pass (108/108; 1 pre-existing BigQuery credentials failure)
  • Verified in browser: typing "etcd" in the Tests page search bar and pressing Enter immediately filters results without page refresh
  • Verified in browser: clearing search restores all results
  • Verified in browser: consecutive searches ("etcd" then "dns" then "scheduling") all work without page refresh
  • Verified in browser: Jobs page search also works correctly after the fix
  • No console errors

Jira: https://issues.redhat.com/browse/TRT-2764


Generated with Claude Code

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: automatic mode

@openshift-ci openshift-ci Bot added the ready-for-human-review Indicates a PR has been reviewed by automated tools and is ready for human review label Jun 30, 2026
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jun 30, 2026
@openshift-ci-robot

openshift-ci-robot commented Jun 30, 2026

Copy link
Copy Markdown

@openshift-trt-agent[bot]: This pull request references TRT-2764 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the bug to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Summary

Fixes the search bar on table pages (Tests, Jobs, etc.) not completing searches after pressing Enter. The URL would update with the search terms, but the table stayed in a loading/spinner state indefinitely. A manual page refresh was required to see results.

Root cause: The requestSearch function in all 11 table components mutated the filterModel object in-place (const currentFilters = filterModel) before passing the same reference to setFilterModel. This broke compatibility with the useStableJSONQueryParam hook (introduced in PR #3711), which stabilizes object references to prevent duplicate API calls. Because the hook's internal ref was mutated in-place, it could not detect that the value had changed, so the useEffect that triggers fetchData would not fire.

Fix: Create a new object in requestSearch instead of mutating the existing filterModel, matching the immutable pattern already used by the addFilters function in these same components.

Files changed (11 table components):

  • sippy-ng/src/tests/TestTable.js
  • sippy-ng/src/tests/FeatureGates.js
  • sippy-ng/src/jobs/JobTable.js
  • sippy-ng/src/jobs/JobRunsTable.js
  • sippy-ng/src/releases/PayloadStreamTestFailures.js
  • sippy-ng/src/releases/PayloadStreamsTable.js
  • sippy-ng/src/releases/PayloadTestFailures.js
  • sippy-ng/src/releases/ReleasePayloadJobRuns.js
  • sippy-ng/src/releases/ReleasePayloadPullRequests.js
  • sippy-ng/src/releases/ReleasePayloadTable.js
  • sippy-ng/src/repositories/RepositoriesTable.js

Screenshots

Before search (all tests loaded):

Tests page before search

After searching "etcd" (results filtered immediately, no page refresh):

Tests page after search for etcd

Test plan

  • make lint passes
  • make test passes (Go unit tests + Jest tests)
  • E2e tests pass (108/108; 1 pre-existing BigQuery credentials failure)
  • Verified in browser: typing "etcd" in the Tests page search bar and pressing Enter immediately filters results without page refresh
  • Verified in browser: clearing search restores all results
  • Verified in browser: consecutive searches ("etcd" then "dns" then "scheduling") all work without page refresh
  • Verified in browser: Jobs page search also works correctly after the fix
  • No console errors

Jira: https://issues.redhat.com/browse/TRT-2764


Generated with Claude Code

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci Bot requested review from deads2k and smg247 June 30, 2026 19:21
@openshift-ci

openshift-ci Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: openshift-trt-agent[bot]
Once this PR has been reviewed and has the lgtm label, please assign neisw for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jun 30, 2026
@openshift-ci

openshift-ci Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Hi @openshift-trt-agent[bot]. Thanks for your PR.

I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

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.

@stbenjam

Copy link
Copy Markdown
Member

/test agentic-staging

@stbenjam

Copy link
Copy Markdown
Member

/ok-to-test

@openshift-ci openshift-ci Bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 30, 2026
@openshift-trt-agent

Copy link
Copy Markdown
Author

Sippy Staging Environment

URL: https://repeat-uni-containing-develop.trycloudflare.com

This environment is built from this PR and will remain available for approximately 60 minutes (until ~21:03 UTC).

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling required tests:
/test e2e

@redhat-chai-bot

Copy link
Copy Markdown
Contributor

/retest ci/prow/agentic-staging

The requestSearch function in 11 table components mutated the
filterModel object returned by useStableJSONQueryParam in place.
This corrupted the hook's internal ref state: the intermediate
re-render from setSearching(true) would detect the mutation via
the defaultValue fallback, update the serialized cache, and then
when the URL update arrived with the same content, the comparison
found no change, so the useEffect never fired and fetchData was
never called.

Fix by creating a new object with spread syntax instead of mutating
the existing filterModel. This ensures useStableJSONQueryParam sees
a genuinely new reference on re-render, triggering the useEffect
and completing the search.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@openshift-trt-agent

Copy link
Copy Markdown
Author

Rebased on latest main (picks up #3720 and #3723). Lint and Jest tests pass locally.

Re: the ci/prow/agentic-staging failure — this is a pre-existing infrastructure timeout, not related to this PR's code changes. The Prow job has a 2-hour timeout, but the total runtime (build + 60-minute staging deployment) exceeded it. The build log shows the staging deployment completed successfully. The same job also failed on PR #3711 (the parent PR, which was merged without issue).

All other CI checks pass: build, e2e, lint, unit, images, security.

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling required tests:
/test e2e

@stbenjam

stbenjam commented Jul 1, 2026

Copy link
Copy Markdown
Member

/test agentic-staging

@openshift-trt-agent

Copy link
Copy Markdown
Author

Sippy Staging Environment

URL: https://seek-throughout-marble-between.trycloudflare.com

This environment is built from this PR and will remain available for approximately 60 minutes (until ~14:14 UTC).

@stbenjam

stbenjam commented Jul 1, 2026

Copy link
Copy Markdown
Member

Bug: If I enter a search term, and it executes, but then click the search magnifying glass icon immediately after (or even pressing enter twice), the page gets stuck in loading but doesn't make any API call (it doesn't need to because that search is already loaded)

@stbenjam

stbenjam commented Jul 1, 2026

Copy link
Copy Markdown
Member

It would be nice when refreshing the page, if there is only one filter in the filterModel for the quick searches field (e.g. name), we re-populate the quick search bar. e.g. tests quick search searches name, but refresh the page and it remains in the filter model, but not the quick search bar.

…n refresh

Fix two issues with the quick search bar:

1. Pressing Enter or clicking the search icon when the same search term
   is already active no longer gets stuck in loading state. The
   requestSearch function in TestTable now checks if the filter would
   actually change before setting the searching state.

2. When refreshing the page, the quick search bar is now repopulated
   from the filterModel URL query parameter. GridToolbar accepts a new
   searchField prop that identifies which filter column corresponds to
   the search bar, and initializes the search text on mount.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@openshift-trt-agent

Copy link
Copy Markdown
Author

@stbenjam Thanks for testing! Both issues are fixed in the latest push:

Bug fix: double-search stuck loading

The requestSearch function in TestTable now checks if the filter would actually change before setting setSearching(true). If the search term matches what's already in the filterModel, the function returns early, so the page never enters a loading state that can't be cleared.

Enhancement: repopulate search bar on page refresh

GridToolbar now accepts a searchField prop that identifies which filter column corresponds to the quick search bar. On mount, if the filterModel (restored from the URL) contains a matching contains filter, the search bar text is initialized from it. All 15 table components pass the appropriate searchField.

Search bar repopulated from filterModel on page refresh

Verified:

  • make lint passes
  • make test passes (Go + Jest)
  • E2e: 108/108 pass (1 pre-existing BigQuery credentials failure)
  • Browser: search + Enter twice no longer gets stuck
  • Browser: search bar repopulates "etcd" when navigating to a URL with a name filter

@stbenjam

stbenjam commented Jul 1, 2026

Copy link
Copy Markdown
Member

/test agentic-staging

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling required tests:
/test e2e

@openshift-trt-agent

Copy link
Copy Markdown
Author

Sippy Staging Environment

URL: https://dot-settlement-walker-islands.trycloudflare.com

This environment is built from this PR and will remain available for approximately 60 minutes (until ~16:18 UTC).

Two fixes in GridToolbar:

1. Remove onBlur handler from search TextField to prevent double-trigger
   when clicking the search icon (onBlur fires before onClick, causing
   two requestSearch calls that can race with state updates and leave
   isSearching stuck as true).

2. Only set initializedFromFilter ref when a search filter is actually
   found, so the search bar gets repopulated from URL params on page
   refresh even if the filterModel is initially empty on first render.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@openshift-trt-agent

Copy link
Copy Markdown
Author

Fixed in 9ca19dd. The root cause was the onBlur handler on the search TextField in GridToolbar. When clicking the magnifying glass icon, onBlur fires before onClick, causing two requestSearch calls in rapid succession. With the useStableJSONQueryParam hook, if the second call sets the same filterModel JSON, the hook returns the same stabilized reference, so the useEffect that calls fetchData doesn't fire, but setSearching(true) was already called, leaving the spinner stuck.

The fix removes the onBlur handler entirely. Search is now only triggered by explicit user action: pressing Enter or clicking the search icon. This is standard search UX and eliminates the double-trigger race condition.

Verified in browser: searched for "etcd", then pressed Enter twice and clicked the search icon. Page stays showing results, not stuck in loading:

Double search and click search icon - not stuck in loading

@openshift-trt-agent

Copy link
Copy Markdown
Author

Fixed in 9ca19dd. The issue was in GridToolbar's useEffect that initializes the search bar from the filterModel. The initializedFromFilter ref was being set to true unconditionally, even when no search filter was found. On page refresh, if the filterModel was initially empty (before URL params were parsed by useQueryParam), the effect would run, find no filter, set the ref to true, and then never re-run when the filterModel was later populated from the URL.

The fix moves initializedFromFilter.current = true inside the if (searchFilter && searchFilter.value) block, so the ref is only set when a search filter is actually found and applied. This allows the effect to keep running on filterModel changes until initialization succeeds.

Verified: after searching for "etcd" and doing a full page reload, the search bar shows "etcd" and results are filtered:

Search bar repopulated after page refresh

@stbenjam

stbenjam commented Jul 1, 2026

Copy link
Copy Markdown
Member

/test agentic-staging

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling required tests:
/test e2e

@openshift-trt-agent

Copy link
Copy Markdown
Author

Sippy Staging Environment

URL: https://heavily-appearance-composer-moral.trycloudflare.com

This environment is built from this PR and will remain available for approximately 60 minutes (until ~17:09 UTC).

@stbenjam

stbenjam commented Jul 1, 2026

Copy link
Copy Markdown
Member

Lol you should not populate the quick search field if the item is a NOT matcher

And you should ONLY populate it if the filter model only has one active filter for name (or the relevant field)

@redhat-chai-bot

Copy link
Copy Markdown
Contributor

/retest ci/prow/agentic-staging

@redhat-chai-bot

Copy link
Copy Markdown
Contributor

/test agentic-staging

@openshift-trt-agent

Copy link
Copy Markdown
Author

Sippy Staging Environment

URL: https://feel-info-alto-trends.trycloudflare.com

This environment is built from this PR and will remain available for approximately 60 minutes (until ~01:52 UTC).

Only initialize the search bar from the URL filterModel when there is
exactly one filter on the search field and it uses a positive 'contains'
operator. This avoids misleadingly populating the search bar for NOT
matchers or when multiple filters exist on the same column.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@openshift-trt-agent

Copy link
Copy Markdown
Author

@stbenjam Fixed in db0562a. The search bar initialization in GridToolbar now:

  1. Counts how many filters exist for the search field column
  2. Only populates the search bar if there is exactly one filter on that field
  3. Only populates if that single filter uses a positive contains operator (not not_contains or any other negated matcher)

If there are multiple filters on the field, or the single filter is a NOT matcher, the search bar stays empty.

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling required tests:
/test e2e

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

Labels

jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. ready-for-human-review Indicates a PR has been reviewed by automated tools and is ready for human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants