feat: 关闭已有刷新页面的定时轮询

This commit is contained in:
GJ
2026-09-04 17:38:59 +08:00
parent e6e0f08072
commit db29367c69
10 changed files with 122 additions and 80 deletions
+22 -17
View File
@@ -38,23 +38,28 @@ export function useStoryboard() {
0
)
const queryKey = computed(() => JSON.stringify([id.value, episodeNo.value]))
const query = usePolling(queryKey, async (key, signal) => {
const [projectId, number] = JSON.parse(key) as [string, number]
if (!projectId || !number) return null
const [directions, visualStates] = await Promise.all([
storyboardApi.directions(projectId, number, signal),
storyboardApi.visualStates(projectId, number, signal)
])
if (
directions.projectId !== projectId ||
visualStates.projectId !== projectId ||
directions.episodeNo !== number ||
visualStates.episodeNo !== number
) {
throw new Error('分镜查询返回了不匹配的项目或剧集,请刷新后重试。')
}
return { directions, visualStates }
})
/** 分镜页已有刷新按钮,不再定时轮询当前剧集。 */
const query = usePolling(
queryKey,
async (key, signal) => {
const [projectId, number] = JSON.parse(key) as [string, number]
if (!projectId || !number) return null
const [directions, visualStates] = await Promise.all([
storyboardApi.directions(projectId, number, signal),
storyboardApi.visualStates(projectId, number, signal)
])
if (
directions.projectId !== projectId ||
visualStates.projectId !== projectId ||
directions.episodeNo !== number ||
visualStates.episodeNo !== number
) {
throw new Error('分镜查询返回了不匹配的项目或剧集,请刷新后重试。')
}
return { directions, visualStates }
},
false
)
const data = query.data
const source = computed(() => sourceEpisodes.value.find(item => item.episodeNo === episodeNo.value))
const shots = computed(() =>