From 640ee25abf37376b0dad633b82cab9a1fd4a17cd Mon Sep 17 00:00:00 2001 From: "Maarten A. Breddels" Date: Wed, 22 Nov 2023 20:10:54 +0100 Subject: [PATCH] refactor: use vue hydration to avoid re-rendering whole page This avoids a flash due to animations/transitions being triggered. --- solara/server/templates/solara.html.j2 | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/solara/server/templates/solara.html.j2 b/solara/server/templates/solara.html.j2 index 131e8c76d..7882104aa 100644 --- a/solara/server/templates/solara.html.j2 +++ b/solara/server/templates/solara.html.j2 @@ -198,14 +198,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 -%}
{% block after_pre_rendered_html %}{% endblock %} {% if vue3 == True %} @@ -334,7 +336,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; }