Skip to content

fix(web): stabilize week view measurements#1691

Merged
Uarmagan merged 1 commit intomainfrom
fix/stabilize-week-measurements
Apr 29, 2026
Merged

fix(web): stabilize week view measurements#1691
Uarmagan merged 1 commit intomainfrom
fix/stabilize-week-measurements

Conversation

@Uarmagan
Copy link
Copy Markdown
Contributor

Summary

  • Move Week view DOM measurement into useGridLayout so grid elements are measured from callback refs instead of child-triggered effects.
  • Guard measurement updates so unchanged sizes do not cause repeated React state updates.
  • Add browser regression coverage for switching from Week to Day/Now through the view dropdown, plus focused hook coverage for stable measurement behavior.

Why

Switching away from Week through the view menu could update the URL while the visible calendar view stayed stuck on Week. The underlying issue was the Week grid measurement flow: AllDayRow could trigger main-grid remeasurement from an effect, and measurement state was updated even when the measured values had not changed. That created an update loop during route/view changes.

This PR makes the layout hook the single owner of measurement setup and only updates state when the measured numbers actually change.

Reviewer Notes

  • AllDayRow no longer asks the layout system to remeasure from an effect.
  • MainGrid still exposes the readable mainGridRef used by existing drag/scroll hooks, while measurement uses a callback ref.
  • Column widths are derived from the latest measured all-day column width instead of being stored separately.

Validation

  • bunx playwright test e2e/navigation/week-view-switch.spec.ts
  • cd packages/web && NODE_ENV=test TZ=Etc/UTC bun test src/views/Calendar/hooks/grid/useGridLayout.test.tsx src/views/Calendar/Calendar.render.test.tsx
  • cd packages/web && NODE_ENV=test TZ=Etc/UTC bun test src/components/SelectView/SelectView.test.tsx
  • bun run test:web
  • bun run type-check
  • bunx biome check e2e/navigation/week-view-switch.spec.ts packages/web/src/views/Calendar/hooks/grid/useGridLayout.ts packages/web/src/views/Calendar/hooks/grid/useGridLayout.test.tsx packages/web/src/views/Calendar/components/Grid/Grid.tsx packages/web/src/views/Calendar/components/Grid/AllDayRow/AllDayRow.tsx packages/web/src/views/Calendar/components/Grid/MainGrid/MainGrid.tsx packages/web/src/common/types/util.types.ts

Note: bun run lint still reports existing unrelated backend lint debt, but the touched files pass Biome cleanly.

@Uarmagan Uarmagan marked this pull request as ready for review April 29, 2026 19:22
@Uarmagan Uarmagan merged commit 45eecdb into main Apr 29, 2026
9 checks passed
@Uarmagan Uarmagan deleted the fix/stabilize-week-measurements branch April 29, 2026 19:22
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