From 8af034db2d9de66ab09fce686f20d7127c2bd778 Mon Sep 17 00:00:00 2001 From: matt kaufman Date: Wed, 11 Dec 2024 10:26:32 -0500 Subject: [PATCH] make number or string, fix || to ?? --- src/DayColumn.js | 2 +- stories/props/eventIdAccessor.mdx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/DayColumn.js b/src/DayColumn.js index c8d039c2d..27eac9917 100644 --- a/src/DayColumn.js +++ b/src/DayColumn.js @@ -210,7 +210,7 @@ class DayColumn extends React.Component { return styledEvents.map(({ event, style }, idx) => { let end = accessors.end(event) let start = accessors.start(event) - let key = accessors.eventId(event) || 'evt_' + idx + let key = accessors.eventId(event) ?? 'evt_' + idx let format = 'eventTimeRangeFormat' let label diff --git a/stories/props/eventIdAccessor.mdx b/stories/props/eventIdAccessor.mdx index 1d21142aa..ae1385557 100644 --- a/stories/props/eventIdAccessor.mdx +++ b/stories/props/eventIdAccessor.mdx @@ -2,9 +2,9 @@ import { Canvas, Story } from '@storybook/addon-docs' # eventIdAccessor -- type: `string | function (event: Object) => string` +- type: `string | number | function (event: Object) => string | number` - default: 'id' -The id of the event. Must resolve to a string. Used as the key for the event in the DOM. If not provided, the event will be given a key of 'evt\_'. +The id of the event. Must resolve to a string or number. Used as the key for the event in the DOM. If not provided, the event will be given a key of 'evt\_{index}'.