Filter recent requests by resolved display stage before pagination
Magent CI/CD / verify (push) Successful in 1m52s
Magent CI/CD / deploy-prod (push) Skipped
Magent CI/CD / deploy-beta (push) Skipped

This commit is contained in:
2026-09-13 12:28:52 +12:00
parent e3332bec1f
commit dcd8082c8d
3 changed files with 58 additions and 9 deletions
+7 -3
View File
@@ -85,6 +85,7 @@ export default function HomePage() {
router.push('/login')
return
}
let cancelled = false
const load = async () => {
setRecentLoading(true)
setRecentError(null)
@@ -100,6 +101,7 @@ export default function HomePage() {
throw new Error(`Auth failed: ${meResponse.status}`)
}
const me = await meResponse.json()
if (cancelled) return
const userRole = me?.role ?? null
setRole(userRole)
setAuthReady(true)
@@ -121,18 +123,20 @@ export default function HomePage() {
throw new Error(`Recent requests failed: ${response.status}`)
}
const data = await response.json()
if (cancelled) return
if (Array.isArray(data?.results)) {
setRecent(normalizeRecentResults(data.results))
}
} catch (error) {
console.error(error)
setRecentError('Recent requests are not available right now.')
if (!cancelled) setRecentError('Recent requests are not available right now.')
} finally {
setRecentLoading(false)
if (!cancelled) setRecentLoading(false)
}
}
load()
void load()
return () => { cancelled = true }
}, [recentDays, recentStage])
useEffect(() => {