fix(requests): remove duplicate queries #249
Merged
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.
Fixes #248
Testing procedure is similar to #247: open the browser devtools or watch the Cryostat backend logs and check how many queries are made
to various endpoints when navigating around the application.
Before this PR, duplicate requests are made when visiting the Events view (two queries for templates and two for event types), and when visiting the Recordings view (two for active recordings and two for archived recordings). When visiting the Recordings view, multiple
GET /api/v1/reports/:reportName
orGET /api/v1/targets/:targetId/reports/:recordingName
will also be observed. After this PR, each of these API endpoints is queried only once on navigation (note that active recordings and archived recordings may both show as simplyrecordings
in your browser devtools since the last component of the API path is the same - however, closer inspection should reveal that one is forGET /api/v1/recordings
(archived) and one forGET /api/v1/targets/:targetId/recordings
(active)). The "reports" requests should only be observed when the graphical dropdown element that contains the report frame is opened.