mantinedev/mantine · error · Error

[@mantine/schedule] ResourcesWeekView: Duplicated event ids

Error message

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

What it means

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.

Source

Thrown at packages/@mantine/schedule/src/components/ResourcesWeekView/get-resources-week-view-events/get-resources-week-view-events.ts:88

  expansionLimit,
}: GetResourcesWeekViewEventsInput): ResourcesWeekViewEventsResult {
  const rangeStart = dayjs(weekdays[0]).startOf('day').toDate();
  const rangeEnd = dayjs(weekdays[weekdays.length - 1])
    .endOf('day')
    .toDate();

  const expandedEvents = expandRecurringEvents({
    events,
    rangeStart,
    rangeEnd,
    expansionLimit,
  });

  if (expandedEvents) {
    const seenIds = new Set<string | number>();
    for (const event of expandedEvents) {
      if (seenIds.has(event.id)) {
        throw new Error(
          `[@mantine/schedule] ResourcesWeekView: Duplicated event ids found: ${event.id}`
        );
      }
      seenIds.add(event.id);
    }
  }

  const byDay: Record<string, ResourcesDayViewEventsResult> = {};

  const assignedIds = new Set<string | number>();

  // Multi-day regular events are rendered as a single all-day bar spanning the days they cover
  // (matching the base WeekView, which treats any multi-day event as all-day), so they are excluded
  // from the per-day timed flow and collected as spanning bars below.
  const isSpanningRegularEvent = (event: ScheduleEventData) =>
    event.display !== 'background' && isMultidayEvent(event);

  for (const day of weekdays) {

View on GitHub (pinned to 8a284e2c2c)

Solutions

  1. Make the expansion function assign unique ids per segment (e.g. append the segment date)
  2. Deduplicate expanded events by id before rendering
  3. If ids collide intentionally, namespace them per resource/week

Example fix

// before
function expand(event) {
  return segments.map((s) => ({ ...event, start: s.start, end: s.end })); // same id
}

// after
function expand(event) {
  return segments.map((s) => ({ ...event, id: `${event.id}-${s.start}`, start: s.start, end: s.end }));
}
Defensive patterns

Strategy: validation

Validate before calling

const expanded = expandEvents(events).map((seg) => ({
  ...seg,
  id: `${seg.id}-${seg.start}`,
}));

<Schedule events={expanded} view="week" 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: 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.

Common situations: 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.

Related errors


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