diff --git a/solara/server/templates/solara.html.j2 b/solara/server/templates/solara.html.j2
index c734a1823..22fdc4cc2 100644
--- a/solara/server/templates/solara.html.j2
+++ b/solara/server/templates/solara.html.j2
@@ -205,14 +205,16 @@
{% endif %}
{% if theme.variant == "auto" %}
{% endif %}
- {% if theme.variant == "light" %}
+ {%- if theme.variant == "light" -%}
- {% elif theme.variant == "dark" %}
+ {%- elif theme.variant == "dark" -%}
- {% endif %}
+ {%- endif -%}
{{ pre_rendered_html|safe }}
+ {%- if pre_rendered_html|length == 0 -%}
{# next div is used in ssg code to see if vue took over rendering #}
+ {%- endif -%}
{% if vue3 == True %}
{% if production %}
@@ -338,7 +340,7 @@
// so we mount it when loading becomes false
if (solara.preRendered && !this.mounted) {
this.isMounted = true;
- this.$mount("#app")
+ this.$mount("#app", true);
} else {
this.isMounted = true;
}