ui: add caching to vulnerability reports (PROJQUAY-7250) #2900
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This moves the API calls to the
secscan
endpoint of Quay to react-query and also adds appropriate caching. This improves load time and resource utilization on the client and server side, since reports can be quite large (>1MB JSON) and there are many of them when loading a tag list view page with lots of manifest lists / OCI indexes, where a secscan API call is issued for every manifest child. The latter are now only issued when someone actually expands the manifest list row in the tag list table to view the child manifests.Using react-query allowed to clean up the code quite a bit and stop leveraging atoms for caching. It even introduced transparent and staggering retry (up to 3 times) which is useful in case the
secscan
endpoint was overloaded.This also changes the empty state view of a manifest detail page on the Packages and Security screen to simply have a message that this manifest didn't contain any content our scanner could recognize instead of still rendering the donut chart and package tables.
PS: There are still too many API calls going to render a tag list view due to a naive approach I took with #2469 - something I will fix in the next PR