Skip to main content
cngx-src documentation

CNGX_TIMELINE_VIEW_FACTORY

Tokenv0.1.0

InjectionToken<CngxTimelineViewFactory>

Description#

Swap point for the body-view mapping. Override it to reshape when the timeline shows a skeleton, content, the empty surface or the error surface - enterprise-wide or per component - without forking the organism.

The mapping is genuinely per-app: whether a pending refetch keeps its rows on screen, whether a background failure surfaces inline or is swallowed until the next settle, and whether an empty result after a filter reads as empty at all are product decisions, not library ones.

providers: [
  {
    provide: CNGX_TIMELINE_VIEW_FACTORY,
    useValue: ((state, isEmpty, labels) => {
      const base = createTimelineView(state, isEmpty, labels);
      // Hold the rows through every refetch, never fall back to placeholders.
      return { ...base, activeView: computed(() => (base.activeView() === 'skeleton' && state()?.hasData() ? 'content' : base.activeView())) };
    }) satisfies CngxTimelineViewFactory,
  },
]

Type#

InjectionToken<CngxTimelineViewFactory>

Provided in#

'root'