@@ -34,17 +34,17 @@ import classNames from "classnames";
3434// -> https://foo.streamlit.app/bar/?embed=true&embed_options=show_padding&embed_options=show_colored_line
3535//
3636const Cloud = ( { name, path, query, height, domain, stylePlaceholder } ) => {
37- // Get the current theme from DOM class (fastest and most accurate )
38- const getCurrentTheme = ( ) => {
37+ // Get the current theme embed option directly (with SSR safety )
38+ const getThemeEmbedOption = ( ) => {
3939 if ( typeof document !== "undefined" ) {
4040 return document . documentElement . classList . contains ( "dark" )
41- ? "dark "
42- : "light " ;
41+ ? "embed_options=dark_theme "
42+ : "embed_options=light_theme " ;
4343 }
44- return "light " ; // Default fallback for SSR
44+ return "embed_options=light_theme " ; // Default fallback for SSR
4545 } ;
4646
47- const currentTheme = getCurrentTheme ( ) ;
47+ const themeEmbedOption = getThemeEmbedOption ( ) ;
4848
4949 if ( ! domain ) domain = `${ name } .streamlit.app` ;
5050 if ( domain . endsWith ( "/" ) ) domain = domain . slice ( 0 , - 1 ) ;
@@ -59,9 +59,6 @@ const Cloud = ({ name, path, query, height, domain, stylePlaceholder }) => {
5959 let normalQueryStr = "" ;
6060 let embedQueryStr = "" ;
6161
62- // Add theme parameter to embed options
63- const themeParam = `embed_options=${ currentTheme } _theme` ;
64-
6562 // Separate "normal" query params from "embed-related" query params.
6663 // This way we can include only the "normal" query params in the Fullscreen link.
6764 // Note that this only applies to iframes rendered via the <Cloud> component
@@ -84,7 +81,7 @@ const Cloud = ({ name, path, query, height, domain, stylePlaceholder }) => {
8481 }
8582
8683 // Add theme parameter to embed query string
87- embedQueryStr += `&${ themeParam } ` ;
84+ embedQueryStr += `&${ themeEmbedOption } ` ;
8885
8986 if ( ! height ) height = "10rem" ;
9087
0 commit comments