{"record":{"id":"b6d90538ca8a735c","repo":"mantinedev/mantine","slug":"mantine-schedule-resourcesweekview-duplicated","errorCode":null,"errorMessage":"[@mantine/schedule] ResourcesWeekView: Duplicated event ids found: ${event.id}","messagePattern":"\\[@mantine/schedule\\] ResourcesWeekView: Duplicated event ids found: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@mantine/schedule/src/components/ResourcesWeekView/get-resources-week-view-events/get-resources-week-view-events.ts","lineNumber":88,"sourceCode":"  expansionLimit,\n}: GetResourcesWeekViewEventsInput): ResourcesWeekViewEventsResult {\n  const rangeStart = dayjs(weekdays[0]).startOf('day').toDate();\n  const rangeEnd = dayjs(weekdays[weekdays.length - 1])\n    .endOf('day')\n    .toDate();\n\n  const expandedEvents = expandRecurringEvents({\n    events,\n    rangeStart,\n    rangeEnd,\n    expansionLimit,\n  });\n\n  if (expandedEvents) {\n    const seenIds = new Set<string | number>();\n    for (const event of expandedEvents) {\n      if (seenIds.has(event.id)) {\n        throw new Error(\n          `[@mantine/schedule] ResourcesWeekView: Duplicated event ids found: ${event.id}`\n        );\n      }\n      seenIds.add(event.id);\n    }\n  }\n\n  const byDay: Record<string, ResourcesDayViewEventsResult> = {};\n\n  const assignedIds = new Set<string | number>();\n\n  // Multi-day regular events are rendered as a single all-day bar spanning the days they cover\n  // (matching the base WeekView, which treats any multi-day event as all-day), so they are excluded\n  // from the per-day timed flow and collected as spanning bars below.\n  const isSpanningRegularEvent = (event: ScheduleEventData) =>\n    event.display !== 'background' && isMultidayEvent(event);\n\n  for (const day of weekdays) {","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/mantinedev/mantine/blob/8a284e2c2c53a9cb6f39f5dc389bf41b7a2073f8/packages/@mantine/schedule/src/components/ResourcesWeekView/get-resources-week-view-events/get-resources-week-view-events.ts#L70-L106","documentation":"ResourcesWeekView validates that expanded (multi-day) events have unique ids after expansion. If expansion produces two entries with the same id (e.g. a recurring/multi-day event expanded into segments that keep the series id), this error is thrown during render.","triggerScenarios":"A multi-day or recurring event expanded into per-day/per-week segments where each segment retains the original id; duplicated ids in the expanded events passed to the resources week view.","commonSituations":"Custom expandEvents implementations that clone an event across week boundaries without adjusting ids; third-party data sources that expand events server-side with repeated ids; upgrading @mantine/schedule versions where expansion behavior changed.","solutions":["Make the expansion function assign unique ids per segment (e.g. append the segment date)","Deduplicate expanded events by id before rendering","If ids collide intentionally, namespace them per resource/week"],"exampleFix":"// before\nfunction expand(event) {\n  return segments.map((s) => ({ ...event, start: s.start, end: s.end })); // same id\n}\n\n// after\nfunction expand(event) {\n  return segments.map((s) => ({ ...event, id: `${event.id}-${s.start}`, start: s.start, end: s.end }));\n}","handlingStrategy":"validation","validationCode":"const expanded = expandEvents(events).map((seg) => ({\n  ...seg,\n  id: `${seg.id}-${seg.start}`,\n}));\n\n<Schedule events={expanded} view=\"week\" resources={resources} />;","typeGuard":"function hasUniqueEventIds(events: { id: string | number }[]): boolean {\n  return new Set(events.map((e) => e.id)).size === events.length;\n}","tryCatchPattern":null,"preventionTips":["Make custom expandEvents implementations re-id every segment","Deduplicate expanded events before passing them to Schedule","Add regression tests covering multi-week events after @mantine/schedule upgrades"],"tags":["schedule","calendar","duplicate-ids","resources-week-view"],"backgroundTag":"duplicate-entity-ids","analyzedSha":"8a284e2c2c53a9cb6f39f5dc389bf41b7a2073f8","analyzedAt":"2026-08-28T10:25:51.087Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}