fix: refresh cached inbound task lists
This commit is contained in:
@@ -17,4 +17,14 @@ describe('InboundTaskList measurement scope', () => {
|
||||
expect(source).toContain("access.can('platform:firstleg:inbound:view') && (row as InboundOrderSummary).orderId")
|
||||
expect(source).not.toContain("name: 'inbound-order-detail', params: { inboundId: row.id }")
|
||||
})
|
||||
|
||||
it('refreshes cached task lists when users return from measurement work', () => {
|
||||
const source = readFileSync(resolve('src/modules/inbounds/components/InboundTaskList.vue'), 'utf8')
|
||||
|
||||
expect(source).toContain('onActivated(() => {')
|
||||
expect(source).toContain('if (!activatedOnce)')
|
||||
expect(source).toContain('activatedOnce = true')
|
||||
expect(source).toContain('void loadTasks()')
|
||||
expect(source).toContain('onMounted(() => { void loadOptions(); void loadTasks() })')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'
|
||||
import { computed, onActivated, onBeforeUnmount, onMounted, ref, watch } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { ClipboardCheck, Eye, Ruler, SearchCheck } from '@lucide/vue'
|
||||
import { useAccessPreviewStore } from '@/core/access/accessPreview'
|
||||
@@ -44,6 +44,7 @@ const selectedInbound = ref<InboundOrderSummary | null>(null)
|
||||
const taskDialogOpen = ref(false)
|
||||
let requestSerial = 0
|
||||
let disposed = false
|
||||
let activatedOnce = false
|
||||
|
||||
const isReview = computed(() => props.mode === 'review')
|
||||
const actionPermission = computed(() => isReview.value
|
||||
@@ -182,6 +183,13 @@ function handleTaskChanged() {
|
||||
|
||||
watch([page, pageSize], () => { void loadTasks() })
|
||||
onMounted(() => { void loadOptions(); void loadTasks() })
|
||||
onActivated(() => {
|
||||
if (!activatedOnce) {
|
||||
activatedOnce = true
|
||||
return
|
||||
}
|
||||
void loadTasks()
|
||||
})
|
||||
onBeforeUnmount(() => { disposed = true; requestSerial += 1 })
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user