diff --git a/src/features/subject-identity/useSubjectIdentity.ts b/src/features/subject-identity/useSubjectIdentity.ts index 3448284..51af361 100644 --- a/src/features/subject-identity/useSubjectIdentity.ts +++ b/src/features/subject-identity/useSubjectIdentity.ts @@ -80,13 +80,13 @@ export function useSubjectIdentity() { ) const subject = computed(() => subjects.value.find(item => item.id === selectedId.value)) const selectionKey = computed(() => subject.value?.id ?? '') - let detail!: ReturnType> + const detailRef = {} as { current?: ReturnType> } const detailPollInterval = computed(() => - detail?.data.value?.images.some(image => image.status === 'pending' || image.status === 'generating') + detailRef.current?.data.value?.images.some(image => image.status === 'pending' || image.status === 'generating') ? 4000 : false ) - detail = usePolling( + const detail = usePolling( selectionKey, async (id, signal) => { if (!id) return null @@ -99,6 +99,7 @@ export function useSubjectIdentity() { }, detailPollInterval ) + detailRef.current = detail const identity = computed(() => detail.data.value?.identity ?? null) const images = computed(() => detail.data.value?.images ?? []) const castingItem = computed(() =>