2
0
mirror of https://github.com/gradio-app/gradio.git synced 2025-04-24 13:01:18 +08:00

Fix wasm_proxied_mount_css to not reuse an existing style element ()

* Fix wasm_proxied_mount_css to not reuse an existing style element but replace it for theme updates upon rerunning a new app

* add changeset

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
This commit is contained in:
Yuichiro Tachibana (Tsuchiya) 2024-03-18 23:30:11 +09:00 committed by GitHub
parent 0a3870d52b
commit f67759dcee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 2 deletions
.changeset
js/app/src/lite

@ -0,0 +1,6 @@
---
"@gradio/app": patch
"gradio": patch
---
fix:Fix wasm_proxied_mount_css to not reuse an existing style element

@ -35,10 +35,11 @@ export async function wasm_proxied_mount_css(
});
const css = new TextDecoder().decode(response.body);
const existing_link = document.querySelector(
// Gradio Lite can be reloaded without refreshing the page, so we need to remove the existing style element if it exists.
const existing_style = document.querySelector(
`style[data-wasm-path='${url_string}']`
);
if (existing_link) return;
existing_style?.remove();
if (url.pathname === DYNAMIC_THEME_CSS_URL_PATH) {
console.debug(