fix no reset
This commit is contained in:
@@ -39,8 +39,8 @@ const duration = computed(() => {
|
||||
return null
|
||||
}
|
||||
|
||||
// When in pause, it can be a tick where now
|
||||
// is behind new Date().
|
||||
// When in pause, it can happen to
|
||||
// have a tick where now is behind new Date().
|
||||
const mostRecentDate = new Date(
|
||||
Math.max(new Date(now.value).getTime(), new Date().getTime())
|
||||
)
|
||||
|
||||
@@ -4,7 +4,7 @@ import RecordResume from '@/modules/record/components/RecordResume.vue'
|
||||
import { useTaskStore } from '@/modules/task/stores/useTask.store'
|
||||
import { formatLongDate } from '@/shared/format-date'
|
||||
import { useLoopyTitle } from '@/shared/useLoopyTitle'
|
||||
import { computed } from 'vue'
|
||||
import { computed, onMounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useTaskRecordStore } from '../stores/useTaskRecordStore'
|
||||
import RecordControls from './RecordControls.vue'
|
||||
@@ -21,10 +21,12 @@ const router = useRouter()
|
||||
|
||||
const task = computed(() => taskStore.getTask(props.taskId))
|
||||
|
||||
if (task.value) {
|
||||
recordStore.syncTaskRecord(task.value)
|
||||
}
|
||||
recordStore.addRecord(props.taskId)
|
||||
onMounted(() => {
|
||||
if (task.value) {
|
||||
recordStore.syncTaskRecord(task.value)
|
||||
}
|
||||
recordStore.initRecord(props.taskId)
|
||||
})
|
||||
|
||||
useLoopyTitle(task.value?.title ?? '')
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ export const useTaskRecordStore = defineStore('task-record-store', {
|
||||
|
||||
const record = this.records[task.id]
|
||||
|
||||
const taskRecordStepIds = Object.keys(record)
|
||||
const taskRecordStepIds = Object.keys(record.stepRecords)
|
||||
const taskStepIds = new Set(task.steps.map((step) => step.id))
|
||||
|
||||
const hasSameSteps =
|
||||
@@ -36,7 +36,7 @@ export const useTaskRecordStore = defineStore('task-record-store', {
|
||||
this.records[task.id] = new TaskRecord(task.id)
|
||||
}
|
||||
},
|
||||
addRecord(taskId: string) {
|
||||
initRecord(taskId: string) {
|
||||
if (taskId in this.records) {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user