Insight loading state sometimes gets skipped if no jobs queued up at the very start
Created by: Joelkw
I noticed that (due to some lucky/unlucky timing) it's possible to load a code insight on a dashboard in a "perfect storm" moment when it's after it has been "processed" (so the backend is aware it exists and can return data; you don't see the "processing" blue alert modal but would normally see the "still running" treatment) but before any jobs have been queued up.
This means that you see a totally empty graph (no data) but without the loading state (no queued jobs so it thinks it's done).
I think that the solution would be to define loading state as either ("any queued jobs?" OR "0 queued jobs and 0 jobs completed and 0 jobs failed"): if there are 0 jobs for all categories of jobs, I believe it has to be loading. I am not 100% convinced so it may be worth checking on that with @coury-clark .
Eventually, though, jobs got queued up and these insights correctly showed a loading state, so this bug doesn't permanently derail the loading state.
Example captured ~11min after creating the insight plus what the API returned at the same moment :
Added for clarity by @unclejustin
There is nothing to do on this issue until we have a flag exposed. Probably when #24244 (closed) is resolved. Then this will be to update the "no data" logic in BackendInsight.tsx
to use that flag.
Example
<BackendAlertOverlay
hasNoData={data.view.loading}
isFetchingHistoricalData={data.view.isFetchingHistoricalData}
/>