Skip to content

fix(event-types): skip save when form has no changes#29674

Open
sreecharan-desu wants to merge 3 commits into
calcom:mainfrom
sreecharan-desu:fix/13112-disable-save-when-unchanged
Open

fix(event-types): skip save when form has no changes#29674
sreecharan-desu wants to merge 3 commits into
calcom:mainfrom
sreecharan-desu:fix/13112-disable-save-when-unchanged

Conversation

@sreecharan-desu

@sreecharan-desu sreecharan-desu commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Fixes #13112

Save was already disabled when the form isn't dirty, but handleSubmit could still fire (programmatic submit) and hit the API anyway. Early return when !isFormDirty.

Checked in the event type editor: no edits → Save stays disabled; change title → Save enables and persists.

Fixes calcom#13112

Save was still reachable via submit paths even with no edits. Bail out of
handleSubmit when the form is not dirty (Save button already disabled in UI).
@github-actions

Copy link
Copy Markdown
Contributor

Welcome to Cal.diy, @sreecharan-desu! Thanks for opening this pull request.

A few things to keep in mind:

  • This is Cal.diy, not Cal.com. Cal.diy is a community-driven, fully open-source fork of Cal.com licensed under MIT. Your changes here will be part of Cal.diy — they will not be deployed to the Cal.com production app.
  • Please review our Contributing Guidelines if you haven't already.
  • Make sure your PR title follows the Conventional Commits format.

A maintainer will review your PR soon. Thanks for contributing!

@github-actions github-actions Bot added community Created by Linear-GitHub Sync Low priority Created by Linear-GitHub Sync Stale ui area: UI, frontend, button, form, input ⚡ Quick Wins A collection of quick wins/quick fixes that are less than 30 minutes of work labels Jun 29, 2026
@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d253daef-1df3-4963-82d0-bb7d992db624

📥 Commits

Reviewing files that changed from the base of the PR and between 5c2159d and 454c321.

📒 Files selected for processing (1)
  • packages/platform/atoms/event-types/wrappers/EventTypePlatformWrapper.tsx

📝 Walkthrough

Walkthrough

useEventTypeForm.ts now returns false when submission is skipped because the form is clean or has no dirty fields, and returns true only after calling onSubmit with the filtered payload and id. EventTypePlatformWrapper.tsx now awaits handleSubmit(data) inside its submit handler and keeps error handling in the catch path.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed It clearly summarizes the main change: skipping saves when the event form has no changes.
Description check ✅ Passed The description matches the submit-fix and references the unchanged-form bug and behavior.
Linked Issues check ✅ Passed The early-return logic prevents saves and API calls when the event form has no changes, matching #13112.
Out of Scope Changes check ✅ Passed The edits stay within event-type submit handling and dirty-state checks, with no unrelated feature work.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/platform/atoms/event-types/hooks/useEventTypeForm.ts`:
- Around line 287-290: The handleSubmit path in useEventTypeForm currently
returns nothing when the form is clean, which lets EventTypePlatformWrapper
treat a skipped submit as a successful save. Update handleSubmit to return an
explicit status/result indicating whether a mutation actually ran, and make the
submit caller in EventTypePlatformWrapper await and check that result before
firing customCallbacks.onSuccess. Use the handleSubmit and
customCallbacks.onSuccess symbols to keep the submit flow from reporting success
on no-op submissions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9317890c-7a1d-4afb-aa42-02e39e0badf6

📥 Commits

Reviewing files that changed from the base of the PR and between b97cd62 and d1b82a7.

📒 Files selected for processing (1)
  • packages/platform/atoms/event-types/hooks/useEventTypeForm.ts

Comment thread packages/platform/atoms/event-types/hooks/useEventTypeForm.ts Outdated
Return a boolean from handleSubmit so programmatic submits on a clean
form do not fire success callbacks.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/platform/atoms/event-types/wrappers/EventTypePlatformWrapper.tsx`:
- Around line 186-191: The success callback is being triggered too early in
EventTypePlatformWrapper because handleSubmit only returns after starting
updateMutation.mutate(data), not after the mutation finishes. Update the
submission flow around form.handleSubmit, handleSubmit, and updateMutation so
onSuccess is fired only from the mutation completion path (for example via
updateMutation.onSuccess/callbacksRef.current) and remove the immediate success
check after await handleSubmit(data) to avoid double-firing and false success.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 00120829-9f13-4f56-b7e3-f04fb7b264db

📥 Commits

Reviewing files that changed from the base of the PR and between d1b82a7 and 5c2159d.

📒 Files selected for processing (2)
  • packages/platform/atoms/event-types/hooks/useEventTypeForm.ts
  • packages/platform/atoms/event-types/wrappers/EventTypePlatformWrapper.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/platform/atoms/event-types/hooks/useEventTypeForm.ts

Comment thread packages/platform/atoms/event-types/wrappers/EventTypePlatformWrapper.tsx Outdated
@github-actions github-actions Bot removed the Stale label Jun 30, 2026
Remove the premature customCallbacks.onSuccess call from the
programmatic submit path so success is only reported from
updateMutation.onSuccess after the request finishes.
@github-actions github-actions Bot added Stale and removed Stale labels Jul 2, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR has been marked as stale due to inactivity. If you're still working on it or need any help, please let us know or update the PR to keep it active.

@github-actions github-actions Bot added the Stale label Jul 11, 2026
@CLAassistant

CLAassistant commented Jul 23, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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

Labels

community Created by Linear-GitHub Sync Low priority Created by Linear-GitHub Sync ⚡ Quick Wins A collection of quick wins/quick fixes that are less than 30 minutes of work size/S Stale ui area: UI, frontend, button, form, input

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CAL-2924] [bug] events can be saved even if it is as same as before

2 participants