{"record":{"id":"a9aae55bf8ca2be9","repo":"mantinedev/mantine","slug":"mantine-schedule-agendaview-duplicated-event-i","errorCode":null,"errorMessage":"[@mantine/schedule] AgendaView: Duplicated event ids found: ${event.id}","messagePattern":"\\[@mantine/schedule\\] AgendaView: Duplicated event ids found: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@mantine/schedule/src/components/AgendaView/get-agenda-view-events.ts","lineNumber":82,"sourceCode":"  const end = dayjs(rangeEnd).startOf('day');\n  const ids = new Set<string | number>();\n\n  for (const event of events) {\n    if (event.display === 'background') {\n      continue;\n    }\n\n    const eventStart = dayjs(event.start).startOf('day');\n    const eventEnd = dayjs(event.end).startOf('day');\n\n    if (eventEnd.isBefore(start) || eventStart.isAfter(end)) {\n      continue;\n    }\n\n    if (!ids.has(event.id)) {\n      ids.add(event.id);\n    } else {\n      throw new Error(`[@mantine/schedule] AgendaView: Duplicated event ids found: ${event.id}`);\n    }\n\n    groupEventByDate(validateEvent(event), groupedEvents, start, end);\n  }\n\n  return groupedEvents;\n}\n","sourceCodeStart":64,"sourceCodeEnd":90,"githubUrl":"https://github.com/mantinedev/mantine/blob/8a284e2c2c53a9cb6f39f5dc389bf41b7a2073f8/packages/@mantine/schedule/src/components/AgendaView/get-agenda-view-events.ts#L64-L90","documentation":"The Schedule component's AgendaView validates that each event has a unique id within the provided events array. When the same event id is encountered twice while grouping events by date, this error is thrown during render, because duplicate ids break event positioning, resizing and editing.","triggerScenarios":"Passing events where two objects share the same id property; the same event object referenced twice in the array; multi-day events duplicated per day by a data transform.","commonSituations":"Fetching events from multiple calendar sources and concatenating arrays with overlapping ids; backend returning duplicated records; a spread/copy bug re-adding an event to the list.","solutions":["Deduplicate events by id before passing to Schedule: events.filter((e, i, a) => a.findIndex((x) => x.id === e.id) === i)","Fix the data source/query that produces duplicate records","Ensure multi-day events are passed once with start/end spanning days, not repeated per day"],"exampleFix":"// before\nconst events = [...googleEvents, ...outlookEvents]; // overlapping ids\n\n// after\nconst events = [...new Map([...googleEvents, ...outlookEvents].map((e) => [e.id, e])).values()];","handlingStrategy":"validation","validationCode":"const dedupeEvents = (events) =>\n  [...new Map(events.map((e) => [e.id, e])).values()];\n\n<Schedule events={dedupeEvents(rawEvents)} />;","typeGuard":"function hasUniqueEventIds(events: { id: string | number }[]): boolean {\n  return new Set(events.map((e) => e.id)).size === events.length;\n}","tryCatchPattern":null,"preventionTips":["Deduplicate merged calendar feeds by id before rendering","Assign unique ids when splitting multi-day events","Add a data-layer test asserting event id uniqueness"],"tags":["schedule","calendar","duplicate-ids","events"],"backgroundTag":"duplicate-entity-ids","analyzedSha":"8a284e2c2c53a9cb6f39f5dc389bf41b7a2073f8","analyzedAt":"2026-08-28T10:25:51.087Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}