{"record":{"id":"9b20efee66369d9c","repo":"mantinedev/mantine","slug":"mantine-schedule-dayview-duplicated-event-ids","errorCode":null,"errorMessage":"[@mantine/schedule] DayView: Duplicated event ids found: ${event.id}","messagePattern":"\\[@mantine/schedule\\] DayView: Duplicated event ids found: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@mantine/schedule/src/components/DayView/get-day-view-events/get-day-view-events.ts","lineNumber":56,"sourceCode":"    const eventEnd = dayjs(event.end);\n    const isOnDay = eventStart.isSame(dayStart, 'day');\n    const spansIntoDay =\n      !isOnDay &&\n      event.display === 'background' &&\n      eventStart.isBefore(dayEnd) &&\n      eventEnd.isAfter(dayStart);\n\n    if (isOnDay || spansIntoDay) {\n      if (isOnDay && !isEventInTimeRange({ event, startTime, endTime })) {\n        continue;\n      }\n\n      const validated = validateEvent(event);\n\n      if (!ids.has(event.id)) {\n        ids.add(event.id);\n      } else {\n        throw new Error(`[@mantine/schedule] DayView: Duplicated event ids found: ${event.id}`);\n      }\n\n      if (event.display === 'background') {\n        backgroundFiltered.push(validated);\n      } else {\n        filteredEvents.push(validated);\n      }\n    }\n  }\n\n  const positionedEvents = getDayPositionedEvents({\n    events: filteredEvents,\n    startTime,\n    endTime,\n    intervalMinutes,\n    date,\n  });\n","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/mantinedev/mantine/blob/8a284e2c2c53a9cb6f39f5dc389bf41b7a2073f8/packages/@mantine/schedule/src/components/DayView/get-day-view-events/get-day-view-events.ts#L38-L74","documentation":"DayView in @mantine/schedule validates each event's id for uniqueness while splitting events into background and foreground lists. A repeated id throws this error at render time because the view relies on ids for DOM keys, drag/resize targets and event lookups.","triggerScenarios":"Two events with the same id in the events prop passed to a Schedule rendering a day view; duplicated all-day events; events copied with spread but keeping the same id instead of generating new ids.","commonSituations":"Splitting one recurring event into instances without assigning unique ids per occurrence; merging event arrays from different sources; optimistic updates that append a copy of an existing event.","solutions":["Generate unique ids for each occurrence: events.map((e, i) => ({ ...e, id: `${e.id}-${i}` })) or use nanoid","Deduplicate by id before rendering","Fix the recurrence expansion logic to assign per-occurrence ids"],"exampleFix":"// before\nconst events = occurrences.map(() => baseEvent); // same id repeated\n\n// after\nconst events = occurrences.map((occ, i) => ({ ...baseEvent, id: `${baseEvent.id}-${occ.start}` }));","handlingStrategy":"validation","validationCode":"const events = rawEvents.map((e, i) => ({\n  ...e,\n  id: `${e.id}-${i}-${e.start}`,\n}));\n\n<Schedule events={events} view=\"day\" />;","typeGuard":"function hasUniqueEventIds(events: { id: string | number }[]): boolean {\n  return new Set(events.map((e) => e.id)).size === events.length;\n}","tryCatchPattern":null,"preventionTips":["Generate per-occurrence ids when expanding recurring events","Use nanoid for user-created events instead of copying source ids","Validate events after every fetch/transform step"],"tags":["schedule","calendar","duplicate-ids","day-view"],"backgroundTag":"duplicate-entity-ids","analyzedSha":"8a284e2c2c53a9cb6f39f5dc389bf41b7a2073f8","analyzedAt":"2026-08-28T10:25:51.087Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}