fix(web): stabilize week view measurements#1691
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
useGridLayoutso grid elements are measured from callback refs instead of child-triggered effects.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:
AllDayRowcould 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
AllDayRowno longer asks the layout system to remeasure from an effect.MainGridstill exposes the readablemainGridRefused by existing drag/scroll hooks, while measurement uses a callback ref.Validation
bunx playwright test e2e/navigation/week-view-switch.spec.tscd packages/web && NODE_ENV=test TZ=Etc/UTC bun test src/views/Calendar/hooks/grid/useGridLayout.test.tsx src/views/Calendar/Calendar.render.test.tsxcd packages/web && NODE_ENV=test TZ=Etc/UTC bun test src/components/SelectView/SelectView.test.tsxbun run test:webbun run type-checkbunx 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.tsNote:
bun run lintstill reports existing unrelated backend lint debt, but the touched files pass Biome cleanly.