{"record":{"id":"8209f59a216d36d7","repo":"mantinedev/mantine","slug":"mantine-schedule-yearview-duplicated-event-ids","errorCode":null,"errorMessage":"[@mantine/schedule] YearView: Duplicated event ids found: ${event.id}","messagePattern":"\\[@mantine/schedule\\] YearView: Duplicated event ids found: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@mantine/schedule/src/components/YearView/get-year-view-events/get-year-view-events.ts","lineNumber":55,"sourceCode":"}\n\nexport function getYearViewEvents({ date, events }: GetYearViewEventsInput) {\n  const groupedEvents: GroupedEvents = {};\n\n  if (events === undefined) {\n    return groupedEvents;\n  }\n\n  const ids = new Set<string | number>();\n\n  for (const event of events) {\n    if (dayjs(event.start).isSame(dayjs(date), 'year')) {\n      groupEventByDate(validateEvent(event), groupedEvents);\n\n      if (!ids.has(event.id)) {\n        ids.add(event.id);\n      } else {\n        throw new Error(`[@mantine/schedule] YearView: Duplicated event ids found: ${event.id}`);\n      }\n    }\n  }\n\n  return groupedEvents;\n}\n","sourceCodeStart":37,"sourceCodeEnd":62,"githubUrl":"https://github.com/mantinedev/mantine/blob/8a284e2c2c53a9cb6f39f5dc389bf41b7a2073f8/packages/@mantine/schedule/src/components/YearView/get-year-view-events/get-year-view-events.ts#L37-L62","documentation":"Thrown by getYearViewEvents in @mantine/schedule when the events array contains two events with identical ids. YearView groups events per date and uses ids for internal bookkeeping; duplicates would corrupt grouping. Validation happens per event as it is matched to the current year.","triggerScenarios":"Passing an events array with duplicate ids to YearView; note the error only fires for duplicates among events whose start date falls within the rendered year.","commonSituations":"Combining events from multiple API endpoints, dragging/copying an event without assigning a new id, or a store bug that appends an event twice during optimistic updates.","solutions":["De-duplicate by id before passing events to YearView","Regenerate ids when cloning or importing events","Check the data layer for double-fetched or double-appended events"],"exampleFix":"// before\n<YearView events={allEvents} /> // allEvents has duplicate ids\n\n// after\nconst deduped = [...new Map(allEvents.map((e) => [e.id, e])).values()];\n<YearView events={deduped} />","handlingStrategy":"validation","validationCode":"const deduped = [...new Map(events.map((e) => [e.id, e])).values()];\n// pass deduped to YearView","typeGuard":"const hasUniqueEventIds = (events: ScheduleEventData[]): boolean =>\n  new Set(events.map((e) => e.id)).size === events.length;","tryCatchPattern":null,"preventionTips":["Assign fresh ids when cloning/importing events","De-duplicate after merging feeds","Log a warning when dropping duplicates during development"],"tags":["mantine","schedule","duplicate-id","validation"],"backgroundTag":"duplicate-entity-id","analyzedSha":"8a284e2c2c53a9cb6f39f5dc389bf41b7a2073f8","analyzedAt":"2026-08-28T10:25:51.087Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}