From fef150c9411ebb8797c17016c25336138cfe8e36 Mon Sep 17 00:00:00 2001 From: Zach Daniel Date: Thu, 2 Feb 2023 00:51:54 -0500 Subject: [PATCH] chore: fix topbar behavior & add missing alias --- assets/js/app.js | 6 +++--- lib/ash_hq_web/components/tree_view.ex | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/assets/js/app.js b/assets/js/app.js index 58a40da..6ec0db7 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -220,7 +220,7 @@ let liveSocket = new LiveSocket("/live", Socket, { topbar.config({ barColors: { 0: "#29d" }, shadowColor: "rgba(0, 0, 0, .3)" }); let topBarScheduled = undefined; -window.addEventListener("phx:page-loading-start", () => { +window.addEventListener("phx:page-loading-start", ({ detail }) => { scrolled = false; // close mobile sidebar on navigation @@ -229,13 +229,14 @@ window.addEventListener("phx:page-loading-start", () => { mobileSideBar.click() } - if (!topBarScheduled) { + if (detail.kind !== 'patch' && !topBarScheduled) { topBarScheduled = setTimeout(() => topbar.show(), 500); } }); window.addEventListener("phx:page-loading-stop", ({ detail }) => { clearTimeout(topBarScheduled); + topbar.hide(); topBarScheduled = undefined; let scrollEl; if (detail.kind === "initial" && window.location.hash) { @@ -251,7 +252,6 @@ window.addEventListener("phx:page-loading-stop", ({ detail }) => { } else { scrolled = true; } - topbar.hide(); }); window.addEventListener("js:focus", (e) => e.target.focus()); diff --git a/lib/ash_hq_web/components/tree_view.ex b/lib/ash_hq_web/components/tree_view.ex index 0b38d86..9bc4dc7 100644 --- a/lib/ash_hq_web/components/tree_view.ex +++ b/lib/ash_hq_web/components/tree_view.ex @@ -8,6 +8,7 @@ defmodule AshHqWeb.Components.TreeView do use Surface.Component alias AshHqWeb.Components.TreeView.Item + alias Surface.Components.LivePatch alias Phoenix.LiveView.JS alias Surface.Components.LivePatch