Fix heartbeat in the js client to be Lite compatible (#7974)

* Fix heartbeat in the js client to be Lite compatible

* add changeset

* add changeset

* Stop assigning the EventSource instance to a variable at heartbeat

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
This commit is contained in:
Yuichiro Tachibana (Tsuchiya) 2024-04-10 23:13:12 +09:00 committed by GitHub
parent 5f0248e797
commit 79e0aa81c9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View File

@ -0,0 +1,6 @@
---
"@gradio/client": patch
"gradio": patch
---
fix:Fix heartbeat in the js client to be Lite compatible

View File

@ -360,9 +360,10 @@ export function api_factory(
const _config = await config_success(config);
// connect to the heartbeat endpoint via GET request
const heartbeat = new EventSource(
const heartbeat_url = new URL(
`${config.root}/heartbeat/${session_hash}`
);
EventSource_factory(heartbeat_url); // Just connect to the endpoint without parsing the response. Ref: https://github.com/gradio-app/gradio/pull/7974#discussion_r1557717540
res(_config);
} catch (e) {
console.error(e);