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 (#7709)
* 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:
parent
0a3870d52b
commit
f67759dcee
6
.changeset/tiny-years-rest.md
Normal file
6
.changeset/tiny-years-rest.md
Normal file
@ -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(
|
||||
|
Loading…
x
Reference in New Issue
Block a user