fix(facets): show loading state instead of No Results flash#818
fix(facets): show loading state instead of No Results flash#818thostetler wants to merge 1 commit intoadsabs:masterfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 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 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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
isLoadingfromuseGetFacetDatainNodeListandNodeListModal. - Treat
isLoadingthe same asisFetchingwhen deciding whether to render loading skeleton/spinner vs empty state.
You can also share your feedback on Copilot code review. Take the survey.
| ); | ||
| } | ||
|
|
||
| if (isFetching) { | ||
| if (isFetching || isLoading) { | ||
| return ( |
There was a problem hiding this comment.
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).
…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.
34cfea7 to
9d534fd
Compare
Summary
isLoadingcheck alongsideisFetchingin bothNodeListandNodeListModalcomponentsisLoading=truebutisFetching=false, causing the empty-state branch to trigger prematurely