diff --git a/Wino.Calendar.ViewModels/CalendarPageViewModel.cs b/Wino.Calendar.ViewModels/CalendarPageViewModel.cs index a8ffb1a7..5d613ecb 100644 --- a/Wino.Calendar.ViewModels/CalendarPageViewModel.cs +++ b/Wino.Calendar.ViewModels/CalendarPageViewModel.cs @@ -963,6 +963,15 @@ public partial class CalendarPageViewModel : CalendarBaseViewModel, base.OnCalendarItemUpdated(calendarItem, source); Debug.WriteLine($"Calendar item updated: {calendarItem.Id}"); + // Local-only calendar operations are persisted immediately without real network I/O. + // Ignore optimistic client updates to prevent applying the same mutation twice. + var isLocalCalendarUpdate = string.IsNullOrWhiteSpace(calendarItem.RemoteEventId) || + calendarItem.RemoteEventId.StartsWith("local-", StringComparison.OrdinalIgnoreCase); + if (isLocalCalendarUpdate && source == CalendarItemUpdateSource.ClientUpdated) + { + return; + } + // Series master events should not be visible on the UI. if (calendarItem.IsRecurringParent) { diff --git a/Wino.Core/Synchronizers/ImapSynchronizer.cs b/Wino.Core/Synchronizers/ImapSynchronizer.cs index 60978d84..61863b8c 100644 --- a/Wino.Core/Synchronizers/ImapSynchronizer.cs +++ b/Wino.Core/Synchronizers/ImapSynchronizer.cs @@ -705,7 +705,10 @@ public class ImapSynchronizer : WinoSynchronizer /// Assigns special folder type for the given local folder. /// If server doesn't support special folders, we can't determine the type. MailKit will throw for GetFolder.