fix: destructure formState properties for proper Proxy subscription - #6
Open
deepshekhardas wants to merge 7 commits into
Open
deepshekhardas wants to merge 7 commits into
deepshekhardas wants to merge 7 commits into
Conversation
added 7 commits
May 11, 2026 14:38
- Add minimumCancellationNotice field to EventType model and types - Create DisableCancellingController component with UI for setting notice period - Add server-side validation in handleCancelBooking - Add client-side validation in booking actions and booking details page - Add isWithinMinimumCancellationNotice utility function Closes calcom#15647
When all calendar integrations (Google Calendar, Outlook, etc.) fail to create events, the booking is now rolled back and cancelled instead of being left as ACCEPTED with no calendar event. This prevents data inconsistency where bookings appear confirmed but have no corresponding calendar event. - Added rollback logic for new bookings when all calendar creation fails - Added rollback logic for rescheduling when all calendar updates fail - Updated error messages to be more user-friendly Closes calcom#28397
When a host reschedules their own booking, the minimum booking notice restriction is now ignored. This allows hosts to reschedule last-minute (e.g., 7pm meeting rescheduled at 6:40pm) without being blocked. The minimum notice still applies to regular bookers/attendees. Closes calcom#18980
Issue: Components accessing formState properties directly (e.g., formState.errors, formState.isDirty) don't re-render when values change because react-hook-form wraps formState with a Proxy. Fix: Destructure formState properties at component level to ensure proper Proxy subscription and correct re-rendering. Refs: calcom#25208
- AvailabilitySettings.tsx: destructure isDirty from formState - HintOrErrors.tsx: destructure errors from formState - address/fields.tsx: destructure errors in InputField and TextAreaField Refs: calcom#25208
- EventTypePlatformWrapper.tsx: errors, isSubmitting - AppleConnect.tsx: isSubmitting - TeamEventTypeForm.tsx: touchedFields Refs: calcom#25208
- CreateEventTypeForm.tsx: touchedFields - TeamEventTypeForm.tsx: errors - HintOrErrors.tsx: isSubmitted, dirtyFields Refs: calcom#25208
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.
Problem
Components accessing
formStateproperties directly (e.g.,formState.errors,formState.isDirty) don't re-render when values change because react-hook-form wrapsformStatewith a Proxy.According to react-hook-form's documentation, the Proxy subscription only works when properties are destructured at the component level before render.
Fix
Destructure
formStateproperties at component level to ensure proper Proxy subscription and correct re-rendering.Changes:
packages/ui/components/form/inputs/Input.tsx: ExtracterrorsfromformStatebefore usingRefs: calcom#25208
Summary by cubic
Adds a minimum cancellation notice to Event Types with a simple UI (“always disable” or “disable when less than X minutes”) and enforces it in the app and API. Also rolls back bookings when all calendar syncs fail, lets hosts bypass minimum booking notice when rescheduling, and fixes form re-renders by destructuring
formStatefromreact-hook-form.New Features
DisableCancellingController.isWithinMinimumCancellationNoticeand hide the cancel action; server rejects cancels inside the window; addsminimumCancellationNoticetoEventType.Bug Fixes
formStateprops across components to ensure Proxy subscription and re-renders (Input, address fields,HintOrErrors,AvailabilitySettings,EventTypePlatformWrapper,AppleConnect,TeamEventTypeForm,CreateEventTypeForm), includingtouchedFields,errors,isSubmitted, anddirtyFieldswhere used.Written for commit f19a6d4. Summary will update on new commits.