mirror of
https://github.com/solidtime-io/solidtime-desktop.git
synced 2026-05-07 20:32:27 +00:00
fix page and query invalidation
This commit is contained in:
@@ -164,8 +164,7 @@ whenever(cmdComma, () => {
|
||||
<div class="flex-1 flex overflow-hidden">
|
||||
<SidebarNavigation />
|
||||
<router-view v-slot="{ Component }">
|
||||
<!-- full-calendar has an issue with keep-alive https://github.com/fullcalendar/fullcalendar/issues/7886 -->
|
||||
<keep-alive exclude="CalendarPage">
|
||||
<keep-alive>
|
||||
<component :is="Component" />
|
||||
</keep-alive>
|
||||
</router-view>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { useQuery, useQueryClient } from '@tanstack/vue-query'
|
||||
import { computed, ref } from 'vue'
|
||||
import { computed, onActivated, ref } from 'vue'
|
||||
import { TimeEntryCalendar, LoadingSpinner } from '@solidtime/ui'
|
||||
import { getAllProjects, useProjectCreateMutation } from '../utils/projects.ts'
|
||||
import { getAllTasks } from '../utils/tasks.ts'
|
||||
@@ -119,6 +119,10 @@ const clients = computed(() => clientsResponse.value?.data ?? [])
|
||||
|
||||
const queryClient = useQueryClient()
|
||||
|
||||
onActivated(() => {
|
||||
queryClient.invalidateQueries({ queryKey: ['timeEntry', 'calendar'] })
|
||||
})
|
||||
|
||||
async function createTimeEntry(entry: Omit<TimeEntry, 'id' | 'organization_id' | 'user_id'>) {
|
||||
if (!currentOrganizationId.value || !currentMembershipId.value) {
|
||||
throw new Error('No organization or member selected')
|
||||
@@ -217,6 +221,7 @@ const { data: activityPeriodsData } = useQuery<ActivityPeriod[]>({
|
||||
end: expandedDateRange.value.end,
|
||||
},
|
||||
]),
|
||||
staleTime: 0,
|
||||
enabled: enableCalendarQuery,
|
||||
placeholderData: (previousData) => previousData,
|
||||
queryFn: async () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { useQuery } from '@tanstack/vue-query'
|
||||
import { computed, ref } from 'vue'
|
||||
import { computed, onActivated, ref } from 'vue'
|
||||
import {
|
||||
Button,
|
||||
LoadingSpinner,
|
||||
@@ -75,6 +75,7 @@ const {
|
||||
end: dateRange.value.end,
|
||||
},
|
||||
]),
|
||||
staleTime: 0,
|
||||
enabled: computed(() => currentOrganizationLoaded.value && activityTrackingEnabled.value),
|
||||
placeholderData: (previousData) => previousData,
|
||||
queryFn: async () => {
|
||||
@@ -87,6 +88,10 @@ const {
|
||||
},
|
||||
})
|
||||
|
||||
onActivated(() => {
|
||||
refetch()
|
||||
})
|
||||
|
||||
const windowActivityStats = computed(() => {
|
||||
return windowActivityStatsData.value || []
|
||||
})
|
||||
@@ -217,7 +222,7 @@ const totalTime = computed(() => {
|
||||
</div>
|
||||
</div>
|
||||
<template v-else>
|
||||
<div class="flex-1 overflow-y-auto">
|
||||
<div class="flex-1 overflow-y-scroll">
|
||||
<div class="max-w-7xl mx-auto px-4 py-4">
|
||||
<!-- Header -->
|
||||
<div class="mb-4">
|
||||
|
||||
Reference in New Issue
Block a user