Skip to content

fix(facets): show loading state instead of No Results flash#818

Open
thostetler wants to merge 1 commit intoadsabs:masterfrom
thostetler:fix/facet-no-results-flash
Open

fix(facets): show loading state instead of No Results flash#818
thostetler wants to merge 1 commit intoadsabs:masterfrom
thostetler:fix/facet-no-results-flash

Conversation

@thostetler
Copy link
Member

@thostetler thostetler commented Mar 4, 2026

Summary

  • Fixed facets briefly displaying "No Results" when searching from the landing page before data loads
  • Added isLoading check alongside isFetching in both NodeList and NodeListModal components
  • When the facet query is initially disabled (search query not yet in state), React Query sets isLoading=true but isFetching=false, causing the empty-state branch to trigger prematurely
image

@codecov
Copy link

codecov bot commented Mar 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 61.9%. Comparing base (47f0a50) to head (9d534fd).

Additional details and impacted files
@@           Coverage Diff            @@
##           master    #818     +/-   ##
========================================
+ Coverage    61.9%   61.9%   +0.1%     
========================================
  Files         317     317             
  Lines       36549   36549             
  Branches     1642    1642             
========================================
+ Hits        22619   22621      +2     
+ Misses      13893   13891      -2     
  Partials       37      37             

see 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@thostetler thostetler requested a review from shinyichen March 4, 2026 18:48
@thostetler thostetler marked this pull request as ready for review March 4, 2026 18:49
Copilot AI review requested due to automatic review settings March 4, 2026 18:49
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Risk summary: Low. Change is limited to UI branching logic for facet loading/empty states and should reduce an observable flicker without affecting the underlying query logic.

This PR updates the SearchFacet facet list components to avoid briefly rendering the “No Results” empty state before facet data is available (notably when the underlying React Query is initially disabled and isFetching is false).

Changes:

  • Include isLoading from useGetFacetData in NodeList and NodeListModal.
  • Treat isLoading the same as isFetching when deciding whether to render loading skeleton/spinner vs empty state.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines 158 to 162
);
}

if (isFetching) {
if (isFetching || isLoading) {
return (
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

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

Optional: add a small regression test covering the new isFetching || isLoading branching (e.g., mock useGetFacetData to return isLoading: true, isFetching: false, treeData: [] and assert the loading state renders instead of the "No Results" empty state for both NodeList and NodeListModal).

Copilot generated this review using guidance from repository custom instructions.
…ial search

When searching from the landing page, facets open by default would briefly
display "No Results" before data loaded. The query starts disabled (search
query not yet in state), so React Query sets isLoading=true but
isFetching=false. Adding isLoading to the guard ensures the spinner shows
while the query is pending.
@thostetler thostetler force-pushed the fix/facet-no-results-flash branch from 34cfea7 to 9d534fd Compare March 5, 2026 14:47
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