0.0.8.5
This commit is contained in:
@@ -70,18 +70,32 @@ function FamilyProviderInner({ children }: { children: React.ReactNode }) {
|
||||
return
|
||||
}
|
||||
|
||||
// 需要加载的树 ID
|
||||
// 如果 URL 中有 treeId,使用它
|
||||
if (treeId) {
|
||||
// 如果正在加载相同的树,跳过
|
||||
if (loadingTreeIdRef.current === treeId) {
|
||||
return
|
||||
}
|
||||
|
||||
// 如果 treeId 与当前树相同,跳过
|
||||
if (treeId === currentTree?.id) {
|
||||
return
|
||||
}
|
||||
} else {
|
||||
// URL 中没有 treeId
|
||||
// 如果已经有当前树,保持不变(避免在页面跳转时丢失上下文)
|
||||
if (currentTree?.id) {
|
||||
return
|
||||
}
|
||||
// 如果没有当前树,加载第一个
|
||||
}
|
||||
|
||||
const targetTreeId = treeId || 'first'
|
||||
|
||||
// 如果正在加载相同的树,跳过
|
||||
if (loadingTreeIdRef.current === targetTreeId) {
|
||||
return
|
||||
}
|
||||
|
||||
// 如果 treeId 与当前树相同,跳过
|
||||
if (treeId && treeId === currentTree?.id) {
|
||||
return
|
||||
}
|
||||
|
||||
// 标记正在加载
|
||||
loadingTreeIdRef.current = targetTreeId
|
||||
|
||||
Reference in New Issue
Block a user