You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DashboardComponent.loadDashboard(dashboardId) dereferences the dashboard without a null/undefined guard, and the effect that drives it can be called with an invalid index. A deep-link (or reload) to a /page/:id that isn't a valid dashboard index leaves activeDashboard at null, and once the gridstack grid is ready the component crashes / renders blank.
Out-of-range id — boot to /page/9 on a 3-dashboard install. applyDashboardParam('9', true) parses 9 (not NaN), so neither defaultToZero branch fires; setActiveDashboardIndex(9) rejects the out-of-range index and activeDashboard stays null. /page/abc is safe (NaN → default 0); only the numeric-but-invalid case leaks through.
DashboardService.applyDashboardParam (dashboard.service.ts) only falls back to index 0 for null/empty/NaN, not for a finite-but-invalid (out-of-range / non-integer) id.
DashboardComponent.loadDashboard (dashboard.component.ts) has no guard for an out-of-range/nulldashboardId.
Suggested direction
loadDashboard: bail (or clamp to a valid index) when dashboards()[dashboardId] is undefined, instead of dereferencing it.
applyDashboardParam: treat any id that setActiveDashboardIndex would reject the same as NaN — fall back to 0 on the defaultToZero path so a stale/invalid deep link lands on page 0.
Context
Pre-existing; surfaced by an adversarial review pass on PR #201 (which fixed the sibling delete() out-of-range regression but deliberately left this component-level crash out of scope). Not introduced by #149.
Problem
DashboardComponent.loadDashboard(dashboardId)dereferences the dashboard without a null/undefined guard, and the effect that drives it can be called with an invalid index. A deep-link (or reload) to a/page/:idthat isn't a valid dashboard index leavesactiveDashboardatnull, and once the gridstack grid is ready the component crashes / renders blank.Two ways in:
/page/9on a 3-dashboard install.applyDashboardParam('9', true)parses9(not NaN), so neitherdefaultToZerobranch fires;setActiveDashboardIndex(9)rejects the out-of-range index andactiveDashboardstaysnull./page/abcis safe (NaN → default 0); only the numeric-but-invalid case leaks through./page/1.5.dashboard.service.tsnow rejects non-integer indices (from dashboard.service: delete() leaves activeDashboard pointing at a shifted index #149), soactiveDashboardstaysnull; before dashboard.service: delete() leaves activeDashboard pointing at a shifted index #149 it setactiveDashboardto1.5, which was also broken (dashboards()[1.5]isundefined). Either way the page crashes — dashboard.service: delete() leaves activeDashboard pointing at a shifted index #149 only changed the route in.Scope / root cause
DashboardService.applyDashboardParam(dashboard.service.ts) only falls back to index 0 fornull/empty/NaN, not for a finite-but-invalid (out-of-range / non-integer) id.DashboardComponent.loadDashboard(dashboard.component.ts) has no guard for an out-of-range/nulldashboardId.Suggested direction
loadDashboard: bail (or clamp to a valid index) whendashboards()[dashboardId]isundefined, instead of dereferencing it.applyDashboardParam: treat any id thatsetActiveDashboardIndexwould reject the same asNaN— fall back to 0 on thedefaultToZeropath so a stale/invalid deep link lands on page 0.Context
Pre-existing; surfaced by an adversarial review pass on PR #201 (which fixed the sibling
delete()out-of-range regression but deliberately left this component-level crash out of scope). Not introduced by #149.