Skip to content

Fix(web): allow user to save event without making changes#1006

Merged
tyler-dane merged 11 commits intomainfrom
refactor/990-cleanup
Sep 26, 2025
Merged

Fix(web): allow user to save event without making changes#1006
tyler-dane merged 11 commits intomainfrom
refactor/990-cleanup

Conversation

@tyler-dane
Copy link
Contributor

@tyler-dane tyler-dane commented Sep 26, 2025

Follow up to #991, minus the Draft schema changes

Closes #990


This pull request refactors and improves the event "dirty check" logic in the web calendar application. It introduces a dedicated parser for determining if an event has been modified, adds comprehensive tests for this logic, and updates the event draft submission flow to use the new implementation. The changes also remove legacy or duplicated dirty-checking code, resulting in a cleaner and more robust codebase.

Event Dirty Check Refactor and Testing

  • Introduced a new WebEventParser class in event.parser.ts to encapsulate the logic for determining if a web event draft has been modified ("dirty"), including nuanced handling of recurrence and date changes. Also exported a standalone isEventDirty function for convenience.
  • Added comprehensive unit tests for the dirty check logic in event.parser.test.ts, covering all relevant event fields, recurrence scenarios, and edge cases.
  • Created a utility function createWebEvent for generating test events in test.event.util.ts to support the new tests.

Integration and Cleanup in Calendar Draft Actions

  • Updated useDraftActions.ts to use the new isEventDirty parser, removing the previous inline implementation and ensuring all dirty checks are consistent and robust. The draft submission logic now uses a new determineSubmitAction helper to decide whether to submit, discard, or just open the form based on event state. [1] [2] [3] [4]
  • Removed the legacy and now-redundant dirty check and new event identification tests from useDraftActions.test.ts.

UI and Miscellaneous

  • Cleaned up the GridDraft component by removing unused code related to the old dirty check and save button disabling. [1] [2]
  • Improved error handling by ensuring errors are logged to the console for debugging.

Copilot AI review requested due to automatic review settings September 26, 2025 19:01
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes an issue where users were unable to save events without making changes by removing the "dirty check" logic that previously disabled the save button when no modifications were detected.

  • Removes the disableSaveBtn prop and related logic throughout the EventForm component hierarchy
  • Refactors the event dirty checking logic into a dedicated parser module with comprehensive testing
  • Updates the submit logic to handle unchanged events by discarding them locally instead of preventing submission

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/web/src/views/Forms/EventForm/types.ts Removes disableSaveBtn prop from FormProps interface
packages/web/src/views/Forms/EventForm/SaveSection/SaveSection.tsx Removes disabled state logic and always enables save button
packages/web/src/views/Forms/EventForm/SaveSection/SaveSection.test.tsx Removes test for disabled save button behavior
packages/web/src/views/Forms/EventForm/EventForm.tsx Removes disableSaveBtn prop usage
packages/web/src/views/Calendar/components/Draft/sidebar/hooks/useSidebarActions.ts Removes unused draft conversion functions
packages/web/src/views/Calendar/components/Draft/hooks/state/useDraftConfirmation.ts Removes dirty check logic from confirmation flow
packages/web/src/views/Calendar/components/Draft/hooks/actions/useDraftActions.ts Refactors submit logic to use new event parser and handle unchanged events
packages/web/src/views/Calendar/components/Draft/hooks/actions/useDraftActions.test.ts Removes old test file for event dirty checking logic
packages/web/src/views/Calendar/components/Draft/grid/GridDraft.tsx Removes dirty check and disableSaveBtn prop usage
packages/web/src/common/utils/event.util.ts Adds error logging to error handler
packages/web/src/common/parsers/event.parser.ts Adds new WebEventParser class for determining if events have been modified
packages/web/src/common/parsers/event.parser.test.ts Adds comprehensive tests for the new event parser
packages/web/src/tests/utils/event.util/test.event.util.ts Adds utility for creating test web events

cursor[bot]

This comment was marked as outdated.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings September 26, 2025 19:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

cursor[bot]

This comment was marked as outdated.

Copilot AI review requested due to automatic review settings September 26, 2025 19:22
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

cursor[bot]

This comment was marked as outdated.

@tyler-dane tyler-dane merged commit ba58110 into main Sep 26, 2025
5 checks passed
@tyler-dane tyler-dane deleted the refactor/990-cleanup branch September 26, 2025 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot save event after making recurrence change

2 participants