fix: Dashboard blank page — move state declarations before use
Unit Tests / test (push) Successful in 11m36s

SERVICES was computed on line 33 using activeServiceIds which was not
declared until line 36. In strict JS, const is not hoisted — this threw
a ReferenceError on mount, crashing the component and showing a blank page.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-30 02:44:41 -04:00
parent 0ed8669aec
commit c493630bb5
+4 -3
View File
@@ -24,6 +24,10 @@ function Dashboard({ isOnline }) {
const { domain = 'cell', cell_name = 'mycell', effective_domain, domain_mode = 'lan' } = useConfig();
const svcDomain = (domain_mode !== 'lan' && effective_domain) ? effective_domain : domain;
const proto = domain_mode === 'lan' ? 'http' : 'https';
const [cellStatus, setCellStatus] = useState(null);
const [servicesStatus, setServicesStatus] = useState(null);
const [activeServiceIds, setActiveServiceIds] = useState(new Set());
const ALL_SERVICE_LINKS = [
{ id: null, name: 'Cell Home', url: domain_mode === 'lan' ? `http://${cell_name}.${domain}` : `https://${svcDomain}`, desc: 'Main UI — no login needed' },
{ id: 'calendar', name: 'Calendar', url: `${proto}://calendar.${svcDomain}`, desc: 'Use your configured account credentials' },
@@ -31,9 +35,6 @@ function Dashboard({ isOnline }) {
{ id: 'email', name: 'Webmail', url: `${proto}://mail.${svcDomain}`, desc: 'Use your configured account credentials' },
];
const SERVICES = ALL_SERVICE_LINKS.filter(s => s.id === null || activeServiceIds.has(s.id));
const [cellStatus, setCellStatus] = useState(null);
const [servicesStatus, setServicesStatus] = useState(null);
const [activeServiceIds, setActiveServiceIds] = useState(new Set());
const [isLoading, setIsLoading] = useState(true);
const [serviceControls, setServiceControls] = useState({});