{"record":{"id":"078724dc9fd81827","repo":"mantinedev/mantine","slug":"mantine-schedule-monthview-duplicated-event-id","errorCode":null,"errorMessage":"[@mantine/schedule] MonthView: Duplicated event ids found: ${event.id}","messagePattern":"\\[@mantine/schedule\\] MonthView: Duplicated event ids found: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@mantine/schedule/src/components/MonthView/get-month-view-events/get-month-view-events.ts","lineNumber":49,"sourceCode":"    return { groupedByDay: {}, groupedByWeek: {}, backgroundByWeek: {} };\n  }\n\n  const ids = new Set<string | number>();\n  const filteredEvents: ScheduleEventData[] = [];\n\n  const range = getMonthRange({ month: date, withOutsideDays, consistentWeeks, firstDayOfWeek });\n\n  for (const event of events) {\n    if (\n      dayjs(event.end).isAfter(range.start, 'day') ||\n      dayjs(event.start).isBefore(range.end, 'day')\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] MonthView: Duplicated event ids found: ${event.id}`);\n      }\n    }\n  }\n\n  return getMonthPositionedEvents({\n    date,\n    events: filteredEvents,\n    firstDayOfWeek,\n    range,\n  });\n}\n","sourceCodeStart":31,"sourceCodeEnd":61,"githubUrl":"https://github.com/mantinedev/mantine/blob/8a284e2c2c53a9cb6f39f5dc389bf41b7a2073f8/packages/@mantine/schedule/src/components/MonthView/get-month-view-events/get-month-view-events.ts#L31-L61","documentation":"MonthView validates that each event id is unique while filtering events for the displayed month. A duplicate id among the month's events throws this error during render, since ids drive positioning and interactions in the month grid.","triggerScenarios":"Two events sharing the same id in the events prop when a month view is displayed; duplicated records from an API; recurring events expanded into instances that all keep the series id.","commonSituations":"Recurring event series where every occurrence keeps the series id; concatenating calendar feeds; caching layers returning stale plus fresh copies of the same event.","solutions":["Give each occurrence a unique id (e.g. `${event.id}-${start}`)","Deduplicate by id before rendering","Fix the API/caching layer that yields duplicates"],"exampleFix":"// before\nconst events = series.map((occ) => ({ ...occ, id: seriesId }));\n\n// after\nconst events = series.map((occ) => ({ ...occ, id: `${seriesId}-${occ.start}` }));","handlingStrategy":"validation","validationCode":"const withOccurrenceIds = (series) =>\n  series.map((occ) => ({ ...occ, id: `${occ.seriesId ?? occ.id}-${occ.start}` }));\n\n<Schedule events={withOccurrenceIds(allEvents)} view=\"month\" />;","typeGuard":"function hasUniqueEventIds(events: { id: string | number }[]): boolean {\n  return new Set(events.map((e) => e.id)).size === events.length;\n}","tryCatchPattern":null,"preventionTips":["Never reuse series ids for expanded occurrences","Deduplicate after merging cached and fetched events","Log id collisions during development with a Set-based check"],"tags":["schedule","calendar","duplicate-ids","month-view"],"backgroundTag":"duplicate-entity-ids","analyzedSha":"8a284e2c2c53a9cb6f39f5dc389bf41b7a2073f8","analyzedAt":"2026-08-28T10:25:51.087Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}