Following up from 496
I have observed cases where useAnalyticsQuery returns an HTTP 200 for a JSON_ARRAY analytics request, but the hook remains in a loading state and later transitions to an error state.
I cannot reproduce this deterministically yet, but I have seen it happen a few times in a test app created with databricks apps init and got a screenshot on one of those instances:
Some investigation I have done.
On the JSON_ARRAY path, an HTTP 200 only means the SSE transport opened successfully via connect-sse.ts:71 and passed the initial response.ok check in connect-sse.ts:80. The hook sets loading to true before starting the request in use-analytics-query.ts:434, and on the JSON_ARRAY branch it opens a per-instance SSE connection in use-analytics-query.ts:487 and use-analytics-query.ts:501. The hook only clears loading once a terminal SSE payload is processed: either type === "result" in use-analytics-query.ts:179 and use-analytics-query.ts:180, or type === "error" in use-analytics-query.ts:190 and use-analytics-query.ts:195. From a consumer point of view, this can look like a successful request that never actually resolves at the hook level.
Happy to help further if you think this is worth fixing.
Following up from 496
I have observed cases where useAnalyticsQuery returns an HTTP 200 for a JSON_ARRAY analytics request, but the hook remains in a loading state and later transitions to an error state.
I cannot reproduce this deterministically yet, but I have seen it happen a few times in a test app created with
databricks apps initand got a screenshot on one of those instances:Some investigation I have done.
On the JSON_ARRAY path, an HTTP 200 only means the SSE transport opened successfully via connect-sse.ts:71 and passed the initial
response.okcheck in connect-sse.ts:80. The hook setsloadingtotruebefore starting the request in use-analytics-query.ts:434, and on the JSON_ARRAY branch it opens a per-instance SSE connection in use-analytics-query.ts:487 and use-analytics-query.ts:501. The hook only clearsloadingonce a terminal SSE payload is processed: eithertype === "result"in use-analytics-query.ts:179 and use-analytics-query.ts:180, ortype === "error"in use-analytics-query.ts:190 and use-analytics-query.ts:195. From a consumer point of view, this can look like a successful request that never actually resolves at the hook level.Happy to help further if you think this is worth fixing.