fix(app): fix errant GET /run/:runId requests #16645
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.
Overview
When viewing the Devices tab on the desktop app, there are a lot of
GET
requests to/runs/null
. These errant requests are generated by two places:useRunStatuses
The complex enabled logic has bit us in the past here - in this case, the custom
enabled
condition overrides the default condition not to fetch if there is norunId
, creating the errant fetch. Prior to notifications, it was important to selectively enable this hook to prevent polling unnecessarily. However, telemetry indicates that pretty much everyone uses notifications, and this hook uses notifications, so for the sake of keeping things simple, let's just remove this logic. Worst case scenario, it's not terrible to poll here if MQTT is blocked.useNotifyRunQuery
A manual
refetch()
does not use the underlyingenabled
conditional logic ofuseRunQuery
. There are two ways to solve it, either the way in this PR, or do extenduseRunQuery
to return a manual refetch function that wraps the custom, lower-levelenabled
logic.For simplicity, I've chosen path 1, but I do think it would be worth revisiting this if we add more notification hooks with "always fetch only in specific circumstances" type logic.
Test Plan and Hands on Testing
runs/:runId
.Changelog
/runs/runId
when there is no active run.Risk assessment
low - this doesn't touch networking in any potentially strange way.