mirror of
https://github.com/gradio-app/gradio.git
synced 2024-11-27 01:40:20 +08:00
Ensure websocket polyfill doesn't load if there is already a global.Webocket
property set (#5840)
* conditional global variable check * move conditional to if block * add changeset * add changeset --------- Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
This commit is contained in:
parent
1724918f06
commit
4e62b8493d
6
.changeset/angry-states-battle.md
Normal file
6
.changeset/angry-states-battle.md
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
"@gradio/client": patch
|
||||
"gradio": patch
|
||||
---
|
||||
|
||||
fix:Ensure websocket polyfill doesn't load if there is already a `global.Webocket` property set
|
@ -255,7 +255,10 @@ export function api_factory(
|
||||
};
|
||||
|
||||
const transform_files = normalise_files ?? true;
|
||||
if (typeof window === "undefined" || !("WebSocket" in window)) {
|
||||
if (
|
||||
(typeof window === "undefined" || !("WebSocket" in window)) &&
|
||||
!global.Websocket
|
||||
) {
|
||||
const ws = await import("ws");
|
||||
NodeBlob = (await import("node:buffer")).Blob;
|
||||
//@ts-ignore
|
||||
|
Loading…
Reference in New Issue
Block a user