260812_02_ENH:IP 기반 자리번호 조회 및 헤더 표시, 컨택에서 리스트 관리로 뒤로 가기 했을 경우 캐싱 제거

This commit is contained in:
2026-08-12 15:06:27 +09:00
parent 081b53945a
commit e9bb02820c
6 changed files with 75 additions and 19 deletions

View File

@@ -2,6 +2,7 @@
import { useEffect, useMemo, useState } from 'react'
import type { PaginationState } from '@tanstack/react-table'
import { useQueryClient } from '@tanstack/react-query'
import { useRouter } from 'next/navigation'
import { LoadingOverlayAdapter } from '@/components/app-shell/LoadingOverlayAdapter'
import { useMounted } from "@kri/common/hooks";
@@ -77,6 +78,7 @@ const createEmptySearchUiState = (): ListSearchUiState => ({
const ListManagePage = () => {
const router = useRouter()
const queryClient = useQueryClient()
const mounted = useMounted()
const { auth } = useAuth()
const { showDialog } = useDialog()
@@ -139,6 +141,17 @@ const ListManagePage = () => {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [mounted, isSelectedProjectHydrated, restoreResolved])
// 브라우저 뒤로가기(popstate)는 Next.js가 이 페이지를 재마운트하지 않고 재사용할 수 있어
// refetchOnMount만으로는 최신 데이터를 보장 못한다. popstate는 브라우저 네이티브 이벤트라
// 재마운트 여부와 무관하게 항상 발생하므로, 여기서 명시적으로 무효화한다.
useEffect(() => {
const handlePopState = () => {
void queryClient.invalidateQueries({ queryKey: ['list', 'search-filter'] })
}
window.addEventListener('popstate', handlePopState)
return () => window.removeEventListener('popstate', handlePopState)
}, [queryClient])
const restoredForThisProject = restoredVisit?.prjctIdx === prjctIdx ? restoredVisit : undefined
const selectedSidSet = useMemo(