🐛 fix(duplicate-event): fix event duplication - web#1001
Merged
victor-enogwe merged 2 commits intomainfrom Sep 26, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a critical bug in the event duplication functionality for the web application. The issue was that when users attempted to duplicate events through right-click context menu or Meta+D shortcut, no new event was created because the duplicate function was passing the original event's _id, causing the system to treat it as an edit operation instead of a create operation.
- Fixes the
duplicateEventfunction to properly generate optimistic IDs for new events - Updates type definitions to use more specific
Schema_WebEventtypes instead of genericSchema_Event - Adds proper type safety and validation improvements across event handling utilities
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| useDraftActions.ts | Core fix: Uses replaceIdWithOptimisticId in duplicate function and improves type safety |
| event.types.ts | Updates type definitions to use Schema_WebEvent instead of Schema_OptimisticEvent |
| grid.event.validator.test.ts | Adds missing position properties to test fixtures for proper validation |
| web.date.util.ts | Removes unused recurrence-related imports and functions |
| event.util.ts | Improves type safety and validation in event preparation utilities |
| web.event.types.ts | Consolidates type definitions and removes unused recurrence enum |
| event.types.ts | Simplifies recurrence schema definitions by removing redundant omit/extend patterns |
| map.event.ts | Improves recurrence handling in the removeProviderData function |
packages/web/src/views/Calendar/components/Draft/hooks/actions/useDraftActions.ts
Show resolved
Hide resolved
packages/web/src/views/Calendar/components/Draft/hooks/actions/useDraftActions.ts
Show resolved
Hide resolved
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.
What does this PR do?
Web fix
The duplicate functionality was completely broken for both calendar and someday events. When users attempted to duplicate an event via right-click context menu or the Meta+D keyboard shortcut, no new event was created and the UI did not update. This regression was introduced in commit
2de11dfduring the recent refactoring of draft actions.Root Cause
The
duplicateEventfunction inuseDraftActions.tswas incorrectly passing the original event's_idto the submit function:When an event has an existing
_id, the submit function treats it as an edit operation rather than a create operation, causing the duplicate to overwrite the original event instead of creating a new one.