261120_01_FIX: 삭제·권한 없는 프로젝트의 리스트 작업 기록이 남아 403이 반복 조회되는 문제 수정

This commit is contained in:
2026-11-20 15:49:06 +09:00
parent 88b36bf27d
commit 904bbd6509
5 changed files with 27 additions and 7 deletions

View File

@@ -1,7 +1,7 @@
'use client'
import { useSyncExternalStore } from 'react'
import { getLocalStorage, setLocalStorage } from '@/store/storage/secure-storage'
import { getLocalStorage, removeLocalStorage, setLocalStorage } from '@/store/storage/secure-storage'
import { StorageKeys } from '@/store/storage/storage-keys'
import { isListJobType, type ListJobType } from '@/types/list-job'
@@ -77,6 +77,14 @@ export const untrackListJob = (jobKey: string) => {
write(jobs.filter((job) => job.jobKey !== jobKey))
}
/** 로그아웃 시 다음 사용자에게 기록이 남지 않게 모두 지운다. 진행 중인 작업은 재로그인 후 my-active 조회로 다시 채워진다. */
export const clearTrackedListJobs = () => {
if (typeof window === 'undefined') return
removeLocalStorage(StorageKeys.ListJobs)
cache = EMPTY
window.dispatchEvent(new Event(CHANGE_EVENT))
}
export const findTrackedListJob = (jobs: TrackedListJob[], userId: string, prjctIdx: number, jobType: ListJobType) =>
jobs.find((job) => job.userId === userId && job.prjctIdx === prjctIdx && job.jobType === jobType)