From 5c38f9f9fc96048c0105a4c69adf6625b8073586 Mon Sep 17 00:00:00 2001 From: SauceyRed Date: Mon, 11 Aug 2025 01:47:04 +0200 Subject: [PATCH] feat: move initialization of navbar state variable to the initializer parameter of its definition --- layouts/client.vue | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/layouts/client.vue b/layouts/client.vue index 98816ce..c327107 100644 --- a/layouts/client.vue +++ b/layouts/client.vue @@ -55,7 +55,18 @@ definePageMeta({ }); const loading = useState("loading", () => false); -const navbar = useState("navbar") +const navbar = useState("navbar", () => { + return { + clientItems: [ + { + title: "Source", + icon: "lucide:code-xml", + callback: () => { open("https://git.gorb.app/gorb/frontend") } + } + ], + channelItems: [] // set by the channel + } +}) const createButtonContainer = ref(); @@ -150,23 +161,6 @@ const options = [ const guilds = await api.fetchMyGuilds(); -onMounted(() => { - if (!navbar.value) { - const sourceLinkItem: NavbarItem = { - title: "Source", - icon: "lucide:code-xml", - callback: () => { open("https://git.gorb.app/gorb/frontend") } - } - - navbar.value = { - clientItems: [ - sourceLinkItem - ], - channelItems: [] // set by the channel - } - } -}) - function createDropdown() { const dropdown = h(GuildDropdown, { options }); const div = document.createElement("div");