Skip to content

Duplicate calendar events when running stable and nightly versions simultaneously #3625

@devin-ai-integration

Description

@devin-ai-integration

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_id values

Proposed Solution

  1. Deterministic event IDs: Generate event IDs from tracking_id_event + started_at instead of random UUIDs. This ensures both app instances generate the same ID for the same event, and TinyBase's setRow will overwrite rather than create duplicates.

  2. 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_id to point to the kept event

Affected Files

  • apps/desktop/src/services/apple-calendar/process/events/execute.ts - Event ID generation
  • apps/desktop/src/utils/index.ts - Utility functions

Related

Reported in 1.0.2-nightly.13

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions