mirror of
https://github.com/truewhile/MeBox.git
synced 2026-10-03 04:26:36 +08:00
优化,排查项目问题
This commit is contained in:
@@ -899,18 +899,23 @@ function StrmDirBrowserDialog({
|
||||
const [crumbs, setCrumbs] = useState<string[]>([])
|
||||
const [entries, setEntries] = useState<StrmRemoteEntry[]>([])
|
||||
const [loading, setLoading] = useState(true)
|
||||
// 递增序号守卫:快速连续进入目录时丢弃过期目录响应
|
||||
const loadSeqRef = useRef(0)
|
||||
|
||||
const load = async (target: string) => {
|
||||
const seq = ++loadSeqRef.current
|
||||
setLoading(true)
|
||||
try {
|
||||
const list = await strmAPI.listRemoteDir(accountId, target)
|
||||
if (seq !== loadSeqRef.current) return
|
||||
setEntries(list)
|
||||
setDir(target)
|
||||
setCrumbs(target ? target.split('/').filter(Boolean) : [])
|
||||
} catch (err) {
|
||||
if (seq !== loadSeqRef.current) return
|
||||
toast.error(apiErrorMessage(err))
|
||||
} finally {
|
||||
setLoading(false)
|
||||
if (seq === loadSeqRef.current) setLoading(false)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user