mantinedev/mantine · error · Error

[@mantine/schedule] ResourcesDayView: Duplicated event ids f

Error message

[@mantine/schedule] ResourcesDayView: Duplicated event ids found: ${event.id}

What it means

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.

Source

Thrown at packages/@mantine/schedule/src/components/ResourcesDayView/get-resources-day-view-events/get-resources-day-view-events.ts:91

    }

    const eventStart = dayjs(event.start);
    const eventEnd = dayjs(event.end);

    const isOnDay = eventStart.isSame(dayStart, 'day');
    const overlapsDay = eventStart.isBefore(dayEnd) && eventEnd.isAfter(dayStart);

    if (isOnDay || overlapsDay) {
      if (isOnDay && !isEventInTimeRange({ event, startTime, endTime })) {
        continue;
      }

      const validated = validateEvent(event);

      if (!ids.has(event.id)) {
        ids.add(event.id);
      } else {
        throw new Error(
          `[@mantine/schedule] ResourcesDayView: Duplicated event ids found: ${event.id}`
        );
      }

      if (event.display === 'background') {
        backgroundByResource[event.resourceId].push(validated);
      } else if (isOnDay) {
        eventsByResource[event.resourceId].push(validated);
      } else {
        const clippedStart = eventStart.isBefore(dayStart) ? dayStart : eventStart;
        const clippedEnd = eventEnd.isAfter(dayEnd) ? dayEnd : eventEnd;

        const clippedEvent = {
          ...validated,
          start: clippedStart.format('YYYY-MM-DD HH:mm:ss'),
          end: clippedEnd.format('YYYY-MM-DD HH:mm:ss'),
        };

View on GitHub (pinned to 8a284e2c2c)

Solutions

  1. Ensure each event object has a globally unique id across resources
  2. Deduplicate by id before passing events to Schedule
  3. Fix the data layer producing per-resource duplicates without unique ids

Example fix

// before
const events = [...eventsForResourceA, ...eventsForResourceB]; // shared meeting, same id

// after
const events = [
  ...eventsForResourceA.map((e) => ({ ...e, id: `a-${e.id}` })),
  ...eventsForResourceB.map((e) => ({ ...e, id: `b-${e.id}` })),
];
Defensive patterns

Strategy: validation

Validate before calling

const namespaced = allResources.flatMap((res) =>
  res.events.map((e) => ({ ...e, id: `${res.id}-${e.id}` }))
);

<Schedule events={namespaced} resources={resources} />;

Type guard

function hasUniqueEventIds(events: { id: string | number }[]): boolean {
  return new Set(events.map((e) => e.id)).size === events.length;
}

Prevention

When it happens

Trigger: 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.

Common situations: Resource calendars merged from multiple backends; recurring or shared meetings duplicated per resource; frontend copies of events keeping the original id.

Related errors


AI-assisted analysis of mantinedev/mantine@8a284e2c2c (2026-08-28). Data as JSON: /api/errors/1568edd888118c72. Report an issue: GitHub.