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

Aperta
#497 1 commento 2 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 3 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
52/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
react, typescript
Ambito
frontend

Direzione di ricerca

Inizia tracciando il flusso JSON_ARRAY in packages/appkit-ui/src/react/hooks/use-analytics-query.ts, in particolare la gestione del payload terminale e la configurazione della connessione alle righe citate, quindi esamina packages/appkit-ui/src/js/sse/connect-sse.ts. Riproducilo in un'app di test creata con databricks apps init; il lavoro è completato quando una richiesta SSE HTTP 200 raggiunge uno stato terminale corretto dell'hook invece di rimanere in caricamento o diventare in seguito un errore imprevisto.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
TypeScript
Stelle
119
Fork
36
Merge medio
4g 16h
PR unite (30g)
37

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di databricks/appkit

Tutte le issue di databricks/appkit

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.