{"record":{"id":"f958026f9204a7fc","repo":"mantinedev/mantine","slug":"mantine-schedule-weekview-duplicated-event-ids","errorCode":null,"errorMessage":"[@mantine/schedule] WeekView: Duplicated event ids found: ${event.id}","messagePattern":"\\[@mantine/schedule\\] WeekView: Duplicated event ids found: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@mantine/schedule/src/components/WeekView/get-week-view-events/filter-week-view-events.ts","lineNumber":45,"sourceCode":"}: FilterWeekViewEventsInput): ScheduleEventData[] {\n  if (events === undefined) {\n    return [];\n  }\n\n  const ids = new Set<string | number>();\n  const filteredEvents: ScheduleEventData[] = [];\n\n  for (const event of events) {\n    if (\n      isWithinWeek({ event, targetWeek: date, firstDayOfWeek }) &&\n      isEventInTimeRange({ event, startTime, endTime })\n    ) {\n      filteredEvents.push(validateEvent(event));\n\n      if (!ids.has(event.id)) {\n        ids.add(event.id);\n      } else {\n        throw new Error(`[@mantine/schedule] WeekView: Duplicated event ids found: ${event.id}`);\n      }\n    }\n  }\n\n  return filteredEvents;\n}\n","sourceCodeStart":27,"sourceCodeEnd":52,"githubUrl":"https://github.com/mantinedev/mantine/blob/8a284e2c2c53a9cb6f39f5dc389bf41b7a2073f8/packages/@mantine/schedule/src/components/WeekView/get-week-view-events/filter-week-view-events.ts#L27-L52","documentation":"Thrown by filterWeekViewEvents in @mantine/schedule when two or more events in the events array share the same id. WeekView relies on ids for lookups, overlapping layout and React keys, so duplicates would produce incorrect week layout or rendering glitches. The library validates eagerly and fails fast instead of rendering wrong data.","triggerScenarios":"Passing an events array to WeekView (or calling getWeekViewEvents) where two events have the same id value, e.g. merging event lists from two sources without de-duplicating, or re-adding an event after moving it between calendars.","commonSituations":"Concatenating events from multiple calendar feeds, copying an event and forgetting to regenerate its id, backend returning nested/repeated entries, or state-management bug appending the same event twice.","solutions":["De-duplicate events by id before rendering (keep the first or last occurrence)","Fix the source of the duplicated id (generate ids with crypto.randomUUID() on creation)","If events legitimately repeat, give each occurrence a unique id and link them via a shared groupId field"],"exampleFix":"// before\n<WeekView events={[...workEvents, ...workEvents]} />\n\n// after\nconst unique = Array.from(new Map(events.map((e) => [e.id, e])).values());\n<WeekView events={unique} />","handlingStrategy":"validation","validationCode":"const hasUniqueIds = (events: ScheduleEventData[]) =>\n  new Set(events.map((e) => e.id)).size === events.length;\n\nif (!hasUniqueIds(events)) {\n  events = [...new Map(events.map((e) => [e.id, e])).values()];\n}","typeGuard":"const hasUniqueEventIds = (events: ScheduleEventData[]): boolean =>\n  new Set(events.map((e) => e.id)).size === events.length;","tryCatchPattern":null,"preventionTips":["Always generate ids at creation time (crypto.randomUUID())","De-duplicate merged event sources by id before rendering","Add a unit test asserting unique ids on your events selector"],"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"}