Skip to content

fix(header): read prop-synced resources, not the lagging event store#32

Draft
anton-patrushev wants to merge 5 commits into
fix/timeline-height-anim-stylefrom
fix/header-resource-prop-sync
Draft

fix(header): read prop-synced resources, not the lagging event store#32
anton-patrushev wants to merge 5 commits into
fix/timeline-height-anim-stylefrom
fix/header-resource-prop-sync

Conversation

@anton-patrushev

Copy link
Copy Markdown
Owner

Problem

CalendarHeader reads resources from the EventsProvider store (useResources()). That store field is written inside notifyDataChanged — an effect — so it lags the resources prop by one commit. On a single → multi-provider transition, the resource header renders empty for that frame while the header band already has its height, producing a visible empty/white header band (surfaced downstream when the consuming app removed a height animation that previously masked the gap).

Fix

Thread the resources prop through CalendarProvider context and read it in CalendarHeader instead of useResources(). Header content now stays in step with the resources prop (and the layout derived from it); no EventsProvider-store dependency for header rendering.

  • CalendarProvider: add resources?: ResourceItem[] to CalendarContextProps.
  • CalendarContainer: pass the resources prop into the context value (+ deps).
  • CalendarHeader: read resources from useCalendar(); drop useResources().

Additive context field; no behavior change in steady state — only removes the one-commit lag on resource changes.

Test plan

  • type:check passes.
  • Day view, multi-provider: switching single ↔ multi shows the resource header without an empty frame.

anton-patrushev and others added 2 commits June 8, 2026 22:44
…the lagging event store

CalendarHeader read `resources` from the EventsProvider store via useResources().
That store field is written inside notifyDataChanged (an effect), so it lags the
`resources` prop by one commit. On a single -> multi-provider transition the
resource header renders empty for that frame while the band already has its
height — a visible empty header band.

Thread the `resources` prop through CalendarProvider context and read it in
CalendarHeader, so header content stays in step with the prop (and the layout
derived from it). No EventsProvider-store dependency for header rendering.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The ResourceListView branch passed `height={dayBarHeight}` but the
CalendarListView branch (byDay mode, enableResourceScroll=false) did not.
Without it the inner ScrollView collapses to 0 and the header cells
(height: '100%') resolve to 0px — provider cells render but are invisible.

Original fix by Vlad Covaliov (GlossGenius/core-mobile#14944); pulled into this
branch so the resource-header fixes ship as one change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@anton-patrushev anton-patrushev force-pushed the fix/header-resource-prop-sync branch from 96ce92f to ec9dde5 Compare June 9, 2026 05:18
notifyDataChanged's skip-gate compared events, timezone, pagesPerSide and
the date window but ignored resources — even though resources is written
into the event store and fed to populateEvents (it decides which column an
event packs into). On a single -> multi provider switch where the events
reference is unchanged, the gate skipped the recompute, so the store kept
its stale resource set and consumers reading it rendered the wrong layout.
Add an identity compare on resources to the gate; the prop is memoized
upstream so steady-state swipes still hit the fast skip path.
…event store

CalendarBody chose its layout (enableResourceScroll, dateResourceItems) from
the resources PROP via useCalendar(), but fed the resources ARRAY into
ResourceListView from the EventsProvider store via useResources(). The store
is written in notifyDataChanged's effect, so it lags the prop by a commit and
can strand on a stale value. When the layout said 'resource mode' but the
store still held no/old resources, ResourceListView computed count: 0 and
rendered an empty (white) grid with no provider columns.

Read resources from the same prop-synced context source as the layout
decision so the two can never disagree. Mirrors the earlier CalendarHeader
fix.
The header wraps its content in an Animated.ScrollView + Animated.View whose
heights are useDerivedValues reading the dayBarHeight prop. On Fabric, when
dayBarHeight flips 0 -> N (e.g. single -> multi resource) during a busy
re-render, the animated height can fail to re-commit and the header stays
clipped at the stale 0: the day-bar/resource cells lay out correctly but are
clipped to invisible (a blank header band). When useAllDayEvent is false there
is no expand/collapse to animate, so drive the two header heights with plain
static values that update synchronously on the React commit, leaving nothing to
strand. The animated path is kept for the all-day-event case.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant