-
Notifications
You must be signed in to change notification settings - Fork 526
Description
Problem
When running both Hyprnote stable (1.0.1) and nightly versions simultaneously, the same calendar event shows up twice in the calendar view.
Root Cause
When two app instances sync calendars concurrently, both could determine the same event needs to be added (since neither sees the other's pending additions), and both would insert with different random UUIDs, creating duplicates.
The current sync logic uses crypto.randomUUID() to generate event IDs when adding new events. Since each app instance generates its own random UUID for the same calendar event, TinyBase creates separate rows for what should be the same event.
Evidence
From the events.json data, events with the same tracking_id_event and started_at appear multiple times with different UUIDs. For example:
- "Hayley Lee <> john" at 2026-01-30T00:20:00Z has 2 entries with different
recurrence_series_idvalues
Proposed Solution
-
Deterministic event IDs: Generate event IDs from
tracking_id_event + started_atinstead of random UUIDs. This ensures both app instances generate the same ID for the same event, and TinyBase'ssetRowwill overwrite rather than create duplicates. -
Cleanup existing duplicates: Add a cleanup mechanism that runs on sync to remove any existing duplicates, being careful to:
- Check if duplicate events have linked sessions before deleting
- Prefer keeping the event that has a session linked to it
- If deleting an event with a linked session, update the session's
event_idto point to the kept event
Affected Files
apps/desktop/src/services/apple-calendar/process/events/execute.ts- Event ID generationapps/desktop/src/utils/index.ts- Utility functions
Related
Reported in 1.0.2-nightly.13
Metadata
Metadata
Assignees
Labels
Type
Projects
Status