mantinedev/mantine · error · Error
[@mantine/schedule] WeekView: Duplicated event ids found: ${
Error message
[@mantine/schedule] WeekView: Duplicated event ids found: ${event.id} What it means
Thrown by filterWeekViewEvents in @mantine/schedule when two or more events in the events array share the same id. WeekView relies on ids for lookups, overlapping layout and React keys, so duplicates would produce incorrect week layout or rendering glitches. The library validates eagerly and fails fast instead of rendering wrong data.
Source
Thrown at packages/@mantine/schedule/src/components/WeekView/get-week-view-events/filter-week-view-events.ts:45
}: FilterWeekViewEventsInput): ScheduleEventData[] {
if (events === undefined) {
return [];
}
const ids = new Set<string | number>();
const filteredEvents: ScheduleEventData[] = [];
for (const event of events) {
if (
isWithinWeek({ event, targetWeek: date, firstDayOfWeek }) &&
isEventInTimeRange({ event, startTime, endTime })
) {
filteredEvents.push(validateEvent(event));
if (!ids.has(event.id)) {
ids.add(event.id);
} else {
throw new Error(`[@mantine/schedule] WeekView: Duplicated event ids found: ${event.id}`);
}
}
}
return filteredEvents;
}
View on GitHub (pinned to 8a284e2c2c)
Solutions
- De-duplicate events by id before rendering (keep the first or last occurrence)
- Fix the source of the duplicated id (generate ids with crypto.randomUUID() on creation)
- If events legitimately repeat, give each occurrence a unique id and link them via a shared groupId field
Example fix
// before
<WeekView events={[...workEvents, ...workEvents]} />
// after
const unique = Array.from(new Map(events.map((e) => [e.id, e])).values());
<WeekView events={unique} /> Defensive patterns
Strategy: validation
Validate before calling
const hasUniqueIds = (events: ScheduleEventData[]) =>
new Set(events.map((e) => e.id)).size === events.length;
if (!hasUniqueIds(events)) {
events = [...new Map(events.map((e) => [e.id, e])).values()];
} Type guard
const hasUniqueEventIds = (events: ScheduleEventData[]): boolean => new Set(events.map((e) => e.id)).size === events.length;
Prevention
- Always generate ids at creation time (crypto.randomUUID())
- De-duplicate merged event sources by id before rendering
- Add a unit test asserting unique ids on your events selector
When it happens
Trigger: Passing an events array to WeekView (or calling getWeekViewEvents) where two events have the same id value, e.g. merging event lists from two sources without de-duplicating, or re-adding an event after moving it between calendars.
Common situations: Concatenating events from multiple calendar feeds, copying an event and forgetting to regenerate its id, backend returning nested/repeated entries, or state-management bug appending the same event twice.
Related errors
- [@mantine/schedule] YearView: Duplicated event ids found: ${
- [@mantine/schedule] Invalid start date for event id: ${event
- [@mantine/schedule] Invalid end date for event id: ${eventDa
- [@mantine/schedule] Event end date is before start date for
- [@mantine/use-form] Form name "${name}" is invalid, it shoul
AI-assisted analysis of mantinedev/mantine@8a284e2c2c (2026-08-28).
Data as JSON: /api/errors/f958026f9204a7fc.
Report an issue: GitHub.