Skip to content

Conversation

@Manas-Kenge
Copy link
Contributor

@Manas-Kenge Manas-Kenge commented Jan 3, 2026

What does this PR do?

Visual Demo

Video Demo (if applicable):

  • Before
Screencast.from.2026-01-03.14-11-19.mp4
  • After
Screencast.from.2026-01-03.14-06-12.mp4

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.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

Summary by cubic

Preserves a day’s custom availability when toggling off and back on, so hours no longer reset to default. Addresses CAL-7011 and #26409.

  • Bug Fixes
    • Save current time slots per day on toggle off, using a per-day map.
    • Restore saved slots on toggle on; fall back to DEFAULT_DAY_RANGE if none exist.

Written for commit 595e53d. Summary will update on new commits.

@vercel
Copy link

vercel bot commented Jan 3, 2026

@Manas-Kenge 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 Jan 3, 2026
@github-actions github-actions bot added the 🐛 bug Something isn't working label Jan 3, 2026
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 issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="packages/features/schedules/components/Schedule.tsx">

<violation number="1" location="packages/features/schedules/components/Schedule.tsx:57">
P1: Module-level `Map` will share preserved time slots across all component instances, causing data corruption when multiple schedules are edited. This should be scoped per form/schedule instance using React Context or a ref passed from the parent `ScheduleComponent`.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

}[FieldPath<TFieldValues>];

// Store preserved time slots for each day to restore when toggling back on
const preservedTimeSlotsRef = new Map<string, TimeRange[]>();
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Jan 3, 2026

Choose a reason for hiding this comment

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

P1: Module-level Map will share preserved time slots across all component instances, causing data corruption when multiple schedules are edited. This should be scoped per form/schedule instance using React Context or a ref passed from the parent ScheduleComponent.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/features/schedules/components/Schedule.tsx, line 57:

<comment>Module-level `Map` will share preserved time slots across all component instances, causing data corruption when multiple schedules are edited. This should be scoped per form/schedule instance using React Context or a ref passed from the parent `ScheduleComponent`.</comment>

<file context>
@@ -53,6 +53,9 @@ export type FieldPathByValue&lt;TFieldValues extends FieldValues, TValue&gt; = {
 }[FieldPath&lt;TFieldValues&gt;];
 
+// Store preserved time slots for each day to restore when toggling back on
+const preservedTimeSlotsRef = new Map&lt;string, TimeRange[]&gt;();
+
 export const ScheduleDay = &lt;TFieldValues extends FieldValues&gt;({
</file context>
Fix with Cubic

@zaidkhan-div
Copy link

can you please understand me how you are working you opened the issue and made a PR @Manas-Kenge ?

Copy link
Member

@dhairyashiil dhairyashiil left a comment

Choose a reason for hiding this comment

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

Address cubic's comment

@dhairyashiil dhairyashiil marked this pull request as draft January 3, 2026 12:32
@dhairyashiil
Copy link
Member

can you please understand me how you are working you opened the issue and made a PR @Manas-Kenge ?

If you come across any bugs, you can open an issue and feel free to start working on it.
Similarly, if you want to add a new feature, open an issue using the feature template.

@github-actions github-actions bot added Low priority Created by Linear-GitHub Sync 🧹 Improvements Improvements to existing features. Mostly UX/UI labels Jan 7, 2026
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 🧹 Improvements Improvements to existing features. Mostly UX/UI Low priority Created by Linear-GitHub Sync size/S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Availability resets to 9–5 when toggling a day off and on

3 participants