Skip to content

fix(sync): add event ownership, undo-safe deletion, and ineligible task cleanup#289

Merged
connectwithprakash merged 3 commits intomainfrom
fix/283-sync-gaps
Mar 15, 2026
Merged

fix(sync): add event ownership, undo-safe deletion, and ineligible task cleanup#289
connectwithprakash merged 3 commits intomainfrom
fix/283-sync-gaps

Conversation

@connectwithprakash
Copy link
Owner

Summary

  • G3 fix: Clean up orphaned calendar events when a task becomes ineligible for sync (date/time/duration removed)
  • G7 fix: Defer calendar event deletion to after the 5-second undo window so undo fully restores both task and event
  • G9 feature: Add isEventOwner flag — tasks created from calendar events never modify or delete the source event on complete/delete

Details

Event Ownership (isEventOwner)

  • New Boolean attribute on TaskEntity (default true, lightweight migration)
  • createTaskFromEvent / createTaskFromCalendarEvent set it to false
  • handleCompletedTask, pushUpdatesToEvent, handleIneligibleTask all guard on ownership
  • deleteTask resolves deleteLinkedEvent to task.isEventOwner when not explicitly passed

Undo-Safe Deletion

  • Soft-delete no longer immediately deletes the linked calendar event
  • Event deletion deferred to commitPendingChanges() (after undo window closes)
  • discardPendingChanges() (undo) works fully — event was never deleted

Ineligible Task Cleanup

  • New handleIneligibleTask method in performForwardSync
  • Catches linked tasks that lost date/time/duration eligibility
  • Deletes orphaned event and unlinks the task

Test plan

  • Create task with date+time+duration → verify event created in Lazyflow calendar
  • Remove date from linked task → verify event deleted and task unlinked
  • Swipe-delete linked task → verify event still exists during 5s undo window
  • Tap undo → verify both task and event restored
  • Let undo window expire → verify event deleted
  • Create task from calendar event → complete it → verify source event untouched
  • Delete task created from event → verify source event untouched

Closes #283

…sk cleanup

- Add isEventOwner flag to Task model (default true). Tasks created
  from calendar events set it to false so completing or deleting
  them never modifies the source event.
- Defer calendar event deletion to commitPendingChanges() so undo
  within the 5-second window preserves both task and event.
- Clean up orphaned calendar events when a task becomes ineligible
  for sync (date, time, or duration removed).
- Extract unlinkTask helper for consistent link-clearing across
  all sync paths.

Closes #283
@netlify
Copy link

netlify bot commented Mar 15, 2026

Deploy Preview for lazyflow canceled.

Name Link
🔨 Latest commit afc8582
🔍 Latest deploy log https://app.netlify.com/projects/lazyflow/deploys/69b67934fdd22900080bbc41

@connectwithprakash connectwithprakash merged commit 21af08e into main Mar 15, 2026
3 checks passed
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.

feat: bidirectional sync between tasks and calendar events

1 participant