fix: init loading

This commit is contained in:
Nikolai Giman
2026-04-06 00:10:25 +02:00
parent 8eab7c2573
commit 8d9276830f
4 changed files with 50 additions and 42 deletions
+14 -9
View File
@@ -5,12 +5,6 @@
:ui="{ content: collapsed ? 'w-48' : 'w-(--reka-dropdown-menu-trigger-width)', group: 'max-h-screen' }"
>
<UButton
v-bind="{
...user,
label: collapsed ? undefined : user?.name,
description: collapsed ? undefined : user?.description,
trailingIcon: collapsed ? undefined : 'i-lucide-chevrons-up-down'
}"
color="neutral"
variant="ghost"
block
@@ -19,7 +13,18 @@
:ui="{
trailingIcon: 'text-dimmed'
}"
/>
>
<template #leading>
<UAvatar :src="user.avatar.src" :alt="user.avatar.alt" size="2xs" />
</template>
<div v-if="!collapsed" class="flex flex-col items-start text-left truncate flex-1">
<span class="truncate text-sm font-medium">{{ user.name }}</span>
<span class="truncate text-xs text-dimmed">{{ user.description }}</span>
</div>
<template v-if="!collapsed" #trailing>
<UIcon name="i-lucide-chevrons-up-down" class="size-4 text-dimmed" />
</template>
</UButton>
<template #chip-leading="{ item }">
<div class="inline-flex items-center justify-center shrink-0 size-5">
@@ -111,8 +116,8 @@ async function handleLogout() {
}
const user = computed(() => ({
name: orgStore.currentOrg?.name || userStore.email || userStore.login,
description: orgStore.currentOrg ? (userStore.email || userStore.login) : undefined,
name: orgStore.currentOrg?.name || userStore.login || userStore.email,
description: userStore.email || userStore.login,
avatar: {
src: avatarImg,
alt: userStore.email || userStore.login,
@@ -36,9 +36,6 @@ const { goals } = storeToRefs(goalsStore)
const activeProjects = computed(() => goals.value.filter(p => p.archive === 0))
const archivedProjects = computed(() => goals.value.filter(p => p.archive === 1))
onMounted(async () => {
await goalsStore.fetchGoals()
})
watch(() => orgStore.currentOrg, async () => {
goalsStore.initialized = false
+33 -30
View File
@@ -1,39 +1,41 @@
<template>
<UDashboardGroup
unit="rem"
storage="local"
class="UDashboardGroup-test"
>
<UDashboardSidebar
id="default"
v-model:open="isSidebarOpen"
:default-size="20"
class="bg-elevated/25"
:class="isSidebarCollapsed ? 'overflow-hidden min-w-0 w-0 transition-[width] duration-200 linear' : 'transition-[width] duration-200 linear'"
:ui="{ footer: 'lg:border-t lg:border-default' }"
<template v-if="orgStore.initialized">
<UDashboardGroup
unit="rem"
storage="local"
class="UDashboardGroup-test"
>
<div class="flex items-center justify-between px-1 gap-2">
<TvGoalLikeItem
to="/user"
variant="taskview"
class="flex-1"
>
{{ t('main') }}
</TvGoalLikeItem>
<NotificationBell />
</div>
<UDashboardSidebar
id="default"
v-model:open="isSidebarOpen"
:default-size="20"
class="bg-elevated/25"
:class="isSidebarCollapsed ? 'overflow-hidden min-w-0 w-0 transition-[width] duration-200 linear' : 'transition-[width] duration-200 linear'"
:ui="{ footer: 'lg:border-t lg:border-default' }"
>
<div class="flex items-center justify-between px-1 gap-2">
<TvGoalLikeItem
to="/user"
variant="taskview"
class="flex-1"
>
{{ t('main') }}
</TvGoalLikeItem>
<NotificationBell />
</div>
<ProjectsSidebar />
<ProjectsSidebar />
<template #footer="{ collapsed }">
<UserMenu :collapsed="collapsed" />
</template>
</UDashboardSidebar>
<template #footer="{ collapsed }">
<UserMenu :collapsed="collapsed" />
</template>
</UDashboardSidebar>
<RouterView />
</UDashboardGroup>
<RouterView />
</UDashboardGroup>
<TvMobileBottomNav />
<TvMobileBottomNav />
</template>
</template>
<script setup lang="ts">
@@ -104,6 +106,7 @@ onMounted(async () => {
await orgStore.fetchOrganizations()
orgStore.restoreCurrentOrg()
await goalsStore.fetchGoals()
await CapacitorUpdater.notifyAppReady()
console.log('notifyAppReady', APP_VERSION)
+3
View File
@@ -8,6 +8,7 @@ export const useOrganizationStore = defineStore('organization', () => {
const currentOrg = ref<Organization | null>(null)
const members = ref<OrgMember[]>([])
const loading = ref(false)
const initialized = ref(false)
async function fetchOrganizations() {
loading.value = true
@@ -125,6 +126,7 @@ export const useOrganizationStore = defineStore('organization', () => {
} else if (organizations.value.length) {
currentOrg.value = organizations.value[0]
}
initialized.value = true
}
return {
@@ -132,6 +134,7 @@ export const useOrganizationStore = defineStore('organization', () => {
currentOrg,
members,
loading,
initialized,
fetchOrganizations,
createOrganization,
updateOrganization,