New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix wasm_proxied_mount_css to not reuse an existing style element #7709
Conversation
… replace it for theme updates upon rerunning a new app
🪼 branch checks and previews
Install Gradio from this PR pip install https://gradio-builds.s3.amazonaws.com/077218139b4ac1a947dad385e3cf227215425b9c/gradio-4.21.0-py3-none-any.whl Install Gradio Python Client from this PR pip install "gradio-client @ git+https://github.com/gradio-app/gradio@077218139b4ac1a947dad385e3cf227215425b9c#subdirectory=client/python" |
🦄 change detectedThis Pull Request includes changes to the following packages.
With the following changelog entry.
Maintainers or the PR author can modify the PR title to modify this entry.
|
`style[data-wasm-path='${url_string}']` | ||
); | ||
if (existing_link) return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was implemented after the non-Wasm ver. which skips mounting the CSS if there is always a mounted element as below.
Lines 17 to 19 in 28342a2
const existing_link = document.querySelector(`link[href='${_url}']`); | |
if (existing_link) return Promise.resolve(); |
However, Lite is different from the normal one in that the app can be executed repeatedly and the frontend can be refreshed many times, so this design was not correct and the requested CSS must be mounted, replacing the old one.
The reason why the background theme is not applied is this: gradio/js/app/src/Index.svelte Lines 259 to 261 in 28342a2
Because handle_darkmode() is not called here due to the if-condition, darkmode() is not called finally, then the background-update code below is not executed.gradio/js/app/src/Index.svelte Line 238 in 28342a2
→What about enforcing the light theme instead of skipping applying the theme when |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @whitphx everything lgtm.
there's a funny effect on playground where the theme also affects the code component.
but i actually think that's fine
@aliabd Thanks! |
Merging as well so that we can do a release soon. Thanks again @whitphx! |
Description
Fixes #7694
See this comment about this PR -> #7709 (comment)