Skip to content

Conversation

@shubham-021
Copy link

@shubham-021 shubham-021 commented Nov 23, 2025

What does this PR do?

The issue was caused by incorrect handling of columnViewExtraDays.current value in packages/features/bookings/Booker/Booker.tsx.

Screenshot 2025-11-24 at 1 43 57 AM

Problem:

  • nonEmptyScheduleDays array changes frequently as schedule data updates
  • addonDays oscillates based on the array length
  • The calculation ran for all layouts, not just column view
  • This caused columnViewExtraDays.current to jump between values 5 and 11

Solution:

  • Wrapped the calculation in useMemo with stable dependencies to prevent unnecessary recalculations.
  • With memo , it only recalculates when dependencies actually change
  • dependency uses nonEmptyScheduleDays.length instead of the array itself
Screenshot 2025-11-24 at 3 00 19 AM

Visual Demo (For contributors especially)

A visual demonstration is strongly recommended, for both the original and new change (video / image - any one).

Video Demo (if applicable):

Reproducing the issue:

problem.mov

After fixing the issue:

solved_2.mov

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

The existing Booker component tests cover the logic.This fix is just an optimization (when the calculation runs), not a logic change.

@vercel
Copy link

vercel bot commented Nov 23, 2025

@shubham-021 is attempting to deploy a commit to the cal Team on Vercel.

A member of the Team first needs to authorize it.

@graphite-app graphite-app bot added the community Created by Linear-GitHub Sync label Nov 23, 2025
@github-actions github-actions bot added the 🐛 bug Something isn't working label Nov 23, 2025
@CLAassistant
Copy link

CLAassistant commented Nov 23, 2025

CLA assistant check
All committers have signed the CLA.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 23, 2025

Hey there and thank you for opening this pull request! 👋🏼

We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted.

Details:

No release type found in pull request title "fix(calendar):Prevent date range header from flickering". Add a prefix to indicate what kind of release this pull request corresponds to. For reference, see https://www.conventionalcommits.org/

Available types:
 - feat: A new feature
 - fix: A bug fix
 - docs: Documentation only changes
 - style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
 - refactor: A code change that neither fixes a bug nor adds a feature
 - perf: A code change that improves performance
 - test: Adding missing tests or correcting existing tests
 - build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
 - ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
 - chore: Other changes that don't modify src or test files
 - revert: Reverts a previous commit

@shubham-021 shubham-021 changed the title fixes:25350/Date range header blinks repeatedly when navigating calendar views fix:25350/Date range header blinks repeatedly when navigating calendar views Nov 23, 2025
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file

Prompt for AI agents (all 1 issues)

Understand the root cause of the following 1 issues and fix them.


<file name="packages/features/bookings/Booker/Booker.tsx">

<violation number="1" location="packages/features/bookings/Booker/Booker.tsx:164">
The memoized column-view extra day calculation only depends on `nonEmptyScheduleDays.length` even though it uses the array’s contents, so updates that change availability without changing the length leave `columnViewExtraDays.current` stale and the header can show wrong day offsets.</violation>
</file>

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR

@shubham-021 shubham-021 changed the title fix:25350/Date range header blinks repeatedly when navigating calendar views fix(calendar):Prevent date range header from flickering Nov 23, 2025
@shubham-021 shubham-021 changed the title fix(calendar):Prevent date range header from flickering fix(calendar): Prevent date range header from flickering Nov 23, 2025
Copy link
Contributor

@Udit-takkar Udit-takkar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unit tests are failing.

@Pallava-Joshi
Copy link
Contributor

marking this draft until then

@Pallava-Joshi Pallava-Joshi marked this pull request as draft November 24, 2025 15:34
@shubham-021 shubham-021 marked this pull request as ready for review November 24, 2025 16:23
@shubham-021
Copy link
Author

shubham-021 commented Nov 24, 2025

@Udit-takkar @Pallava-Joshi
My changes only affects:

  • packages/features/bookings/Booker/Booker.tsx
  • packages/features/bookings/Booker/__mocks__/config.ts
  • packages/features/bookings/Booker/__tests__/Booker.test.tsx

All Booker-specific tests pass successfully

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐛 bug Something isn't working community Created by Linear-GitHub Sync size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Date range header blinks repeatedly when navigating calendar views

4 participants