fix: stop infinite loading spinner when user has no company
Dashboard pages hung on "加载仪表盘数据..." when auth.company was null (e.g. admin user). Now sets loading=false immediately when no company is present, so the page renders instead of spinning forever. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
9ecf3c3179
commit
6b866738be
@ -74,7 +74,10 @@ export function PurchaserDashboard() {
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (!auth.company) return;
|
||||
if (!auth.company) {
|
||||
setLoading(false);
|
||||
return;
|
||||
}
|
||||
// 如果数据已加载,不再重新加载
|
||||
if (dataLoaded && plans.length > 0) {
|
||||
setLoading(false);
|
||||
|
||||
@ -62,7 +62,10 @@ export function TextileDashboard() {
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (!auth.company) return;
|
||||
if (!auth.company) {
|
||||
setLoading(false);
|
||||
return;
|
||||
}
|
||||
fetchPlans();
|
||||
// 从 localStorage 读取被拒绝的计划ID
|
||||
const stored = localStorage.getItem(STORAGE_KEYS.textileRejectedPlans);
|
||||
|
||||
@ -69,7 +69,10 @@ export function WashingDashboard() {
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (!auth.company) return;
|
||||
if (!auth.company) {
|
||||
setLoading(false);
|
||||
return;
|
||||
}
|
||||
fetchPlans();
|
||||
}, [auth.company]);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user