Skip to content

fix(home-custom): guard appels complete callback against undefined data

Fix 1 - home-custom crash (the TypeError)

DataTaskController legitimately resolves undefined on its early-return path - lit Task then calls complete(undefined). Upstream !80 wave added if (data) guards to every complete callback in home.ts, but fork-only home-custom.ts predates that wave: its _renderAppelList callback dereferenced data.filter(...) unguarded.

Fix: if (!data) return; - same semantics as upstream home.ts.

Fix 2 - detail pages empty on direct URL load

Root cause (CDP-verified): sib-router 0.13 only sets data-src on a route's elements during client-side navigation (updateResource inside navigate -> display -> activate). Direct-loading /action-group-detail/1384/ activates the route but the resource cannot be resolved (router parses the segment after @ - a plain path has none) - dataSrc stays empty - page renders only its shell.

Not a regression from the wave: verified identical behavior on prod palestine (pre-wave code). Click-nav (list -> card CTA) works everywhere; direct loads never bound.

Fix: RiseforComponent._afterAttach detects the unbound case on bind-resources components and replays the navigation through the router with the composed full resource URL (VITE_INSTANCE_HOSTNAME + container + id) - same payload a list-card CTA sends. Route-container map in directLoadResource.ts; per-instance default-data-src attribute takes precedence.

Verified live (CDP): direct load now renders the full campaign; click-nav unchanged; no double-bind. tsc: no new errors.

Test plan

  • Direct-load /action-group-detail/<id>/ and /appel-soutiens-detail/<id>/ - content should render
  • Click an action card from the list - detail still renders
  • Home page - no more filter TypeError
Edited by Scaffold Digital Fleet

Merge request reports