useAnalyticsQuery can stay loading or later transition to error after HTTP 200 on JSON_ARRAY SSE requests

未關閉
#497 1 則留言 2 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 3 天內回覆

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
52/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
冷清
技術堆疊
react, typescript
領域
frontend

研究方向

先追蹤 packages/appkit-ui/src/react/hooks/use-analytics-query.ts 中的 JSON_ARRAY 流程,尤其是檢查引用行中的終端 payload 處理和連線設定,接著檢查 packages/appkit-ui/src/js/sse/connect-sse.ts。在使用 databricks apps init 建立的測試應用程式中重現此流程;當 HTTP 200 SSE 請求到達正確的終端 hook 狀態,而不是一直停留在 loading 狀態或之後變成未預期的錯誤時,即表示完成。

由索引模型根據 Issue 內容生成。

描述

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:

Image

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.

主要語言
TypeScript
星號
119
分支
36
平均合併
4 天 16 小時
30 天內合併 PR
37

環境準備

  • 沒有 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

databricks/appkit 的其他 Issue

查看 databricks/appkit 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。