Fix flashing on reapplying theme (#3760)

* Fix flashing on reapplying theme

This seem to be making a difference on staging

* Add `blocking="rendering"` attribute
pull/3753/head^2 r2024.02.07-342
hq1 3 years ago committed by GitHub
parent 6ce4d19931
commit 9f2f894421
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -5,7 +5,7 @@ defmodule PlausibleWeb.Components.Layout do
def theme_script(assigns) do
~H"""
<script>
<script blocking="rendering">
(function(){
var themePref = '<%= theme_preference(assigns) %>';
function reapplyTheme() {

@ -25,6 +25,7 @@
"Plausible · Simple, privacy-friendly alternative to Google Analytics" %>
</title>
<link rel="stylesheet" href={Routes.static_path(@conn, "/css/app.css")} />
<PlausibleWeb.Components.Layout.theme_script {Map.take(assigns, [:current_user, :theme])} />
<%= render("_tracking.html", assigns) %>
</head>
<body
@ -45,8 +46,6 @@
<%= Map.get(assigns, :inner_layout) || @inner_content %>
</main>
<PlausibleWeb.Components.Layout.theme_script {Map.take(assigns, [:current_user, :theme])} />
<%= if assigns[:embedded] do %>
<div data-iframe-height></div>
<script type="text/javascript" src={Routes.static_path(@conn, "/js/embed.content.js")}>

Loading…
Cancel
Save