From 8f6c3631ff5b2160e7388458cce717013e946b94 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 99377c98a..dd98a2cf5 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 -%}
{% block after_pre_rendered_html %}{% endblock %} {% if vue3 == True %} @@ -339,7 +341,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; }