{"record":{"id":"1568edd888118c72","repo":"mantinedev/mantine","slug":"mantine-schedule-resourcesdayview-duplicated-e","errorCode":null,"errorMessage":"[@mantine/schedule] ResourcesDayView: Duplicated event ids found: ${event.id}","messagePattern":"\\[@mantine/schedule\\] ResourcesDayView: Duplicated event ids found: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@mantine/schedule/src/components/ResourcesDayView/get-resources-day-view-events/get-resources-day-view-events.ts","lineNumber":91,"sourceCode":"    }\n\n    const eventStart = dayjs(event.start);\n    const eventEnd = dayjs(event.end);\n\n    const isOnDay = eventStart.isSame(dayStart, 'day');\n    const overlapsDay = eventStart.isBefore(dayEnd) && eventEnd.isAfter(dayStart);\n\n    if (isOnDay || overlapsDay) {\n      if (isOnDay && !isEventInTimeRange({ event, startTime, endTime })) {\n        continue;\n      }\n\n      const validated = validateEvent(event);\n\n      if (!ids.has(event.id)) {\n        ids.add(event.id);\n      } else {\n        throw new Error(\n          `[@mantine/schedule] ResourcesDayView: Duplicated event ids found: ${event.id}`\n        );\n      }\n\n      if (event.display === 'background') {\n        backgroundByResource[event.resourceId].push(validated);\n      } else if (isOnDay) {\n        eventsByResource[event.resourceId].push(validated);\n      } else {\n        const clippedStart = eventStart.isBefore(dayStart) ? dayStart : eventStart;\n        const clippedEnd = eventEnd.isAfter(dayEnd) ? dayEnd : eventEnd;\n\n        const clippedEvent = {\n          ...validated,\n          start: clippedStart.format('YYYY-MM-DD HH:mm:ss'),\n          end: clippedEnd.format('YYYY-MM-DD HH:mm:ss'),\n        };\n","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/mantinedev/mantine/blob/8a284e2c2c53a9cb6f39f5dc389bf41b7a2073f8/packages/@mantine/schedule/src/components/ResourcesDayView/get-resources-day-view-events/get-resources-day-view-events.ts#L73-L109","documentation":"ResourcesDayView splits events per resource and validates id uniqueness across all of them. When the same event id is seen twice while building per-resource lists, this error is thrown at render time.","triggerScenarios":"Duplicate ids in the events prop when using Schedule with resources (day or week resource views); the same event assigned to multiple resource entries with the same id; API returning the same event twice for different resources without distinct ids.","commonSituations":"Resource calendars merged from multiple backends; recurring or shared meetings duplicated per resource; frontend copies of events keeping the original id.","solutions":["Ensure each event object has a globally unique id across resources","Deduplicate by id before passing events to Schedule","Fix the data layer producing per-resource duplicates without unique ids"],"exampleFix":"// before\nconst events = [...eventsForResourceA, ...eventsForResourceB]; // shared meeting, same id\n\n// after\nconst events = [\n  ...eventsForResourceA.map((e) => ({ ...e, id: `a-${e.id}` })),\n  ...eventsForResourceB.map((e) => ({ ...e, id: `b-${e.id}` })),\n];","handlingStrategy":"validation","validationCode":"const namespaced = allResources.flatMap((res) =>\n  res.events.map((e) => ({ ...e, id: `${res.id}-${e.id}` }))\n);\n\n<Schedule events={namespaced} 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":["Namespace event ids per resource when merging feeds","Ensure backend APIs return globally unique event ids across resources","Dedupe events in a single data-preparation hook used by all views"],"tags":["schedule","calendar","duplicate-ids","resources-day-view"],"backgroundTag":"duplicate-entity-ids","analyzedSha":"8a284e2c2c53a9cb6f39f5dc389bf41b7a2073f8","analyzedAt":"2026-08-28T10:25:51.087Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}