-
Notifications
You must be signed in to change notification settings - Fork 11.5k
fix: Availability reset to default hours on day toggle #26410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
@Manas-Kenge is attempting to deploy a commit to the cal Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this 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[]>(); |
There was a problem hiding this comment.
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<TFieldValues extends FieldValues, TValue> = {
}[FieldPath<TFieldValues>];
+// Store preserved time slots for each day to restore when toggling back on
+const preservedTimeSlotsRef = new Map<string, TimeRange[]>();
+
export const ScheduleDay = <TFieldValues extends FieldValues>({
</file context>
|
can you please understand me how you are working you opened the issue and made a PR @Manas-Kenge ? |
dhairyashiil
left a comment
There was a problem hiding this 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
If you come across any bugs, you can open an issue and feel free to start working on it. |
What does this PR do?
Visual Demo
Video Demo (if applicable):
Screencast.from.2026-01-03.14-11-19.mp4
Screencast.from.2026-01-03.14-06-12.mp4
Mandatory Tasks (DO NOT REMOVE)
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.
Written for commit 595e53d. Summary will update on new commits.