Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fleet UI: Switching vuln search types does not cause page re-render #22418

Merged
merged 2 commits into from
Sep 30, 2024

Conversation

RachelElysia
Copy link
Member

Issue

Cerra #21923

Description

  • Problem: Page level loading spinner was showing when calling different APIs because (isLoading and isLoadingExactMatch turn true on calling a different API
  • Solution: Only show page level loading spinner on first load

Screenrecording of fix

https://www.loom.com/share/12315498c89d4e8caf8527a9f1e1d498?sid=98023e8c-be25-4625-b014-08934bb9641c

Checklist for submitter

If some of the following don't apply, delete the relevant line.

  • Changes file added for user-visible changes in changes/, orbit/changes/ or ee/fleetd-chrome/changes.
  • Manual QA for all new/changed functionality

@@ -238,7 +247,7 @@ const SoftwareVulnerabilities = ({
}
}, [queryParams.exploit, isExactMatchQuery]);

if (isLoading || isLoadingExactMatch) {
if (isInitialLoad && (isLoading || isLoadingExactMatch)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of adding a whole new state variable and associated useEffect, we could probably just use presence of some existing data/state in this check. Either !query or !tableData should work, e.g.

if (!query && (isLoading || isLoadingExactMatch) {...

Wdyt?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yo yo, love the suggestion !query won't work because won't work because changing the search field from a string to empty string causes the loading spinner, but !tableData will since it's always present after first load! Just tested and all! Thanks!!!

Copy link

codecov bot commented Sep 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 65.21%. Comparing base (3ca1f5b) to head (a965d74).
Report is 43 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #22418      +/-   ##
==========================================
- Coverage   65.21%   65.21%   -0.01%     
==========================================
  Files        1496     1496              
  Lines      117161   117162       +1     
  Branches     3567     3571       +4     
==========================================
  Hits        76408    76408              
  Misses      33644    33644              
- Partials     7109     7110       +1     
Flag Coverage Δ
frontend 52.36% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@RachelElysia RachelElysia merged commit 9fa8244 into main Sep 30, 2024
14 checks passed
@RachelElysia RachelElysia deleted the 21923-lose-focus branch September 30, 2024 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants