Skip to content

Commit 35f9da7

Browse files
Address code review feedback: improve ID generation stability
Co-authored-by: xuyushun441-sys <255036401+xuyushun441-sys@users.noreply.github.com>
1 parent 86b42b8 commit 35f9da7

4 files changed

Lines changed: 5 additions & 5 deletions

File tree

packages/views/src/ObjectCalendar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ export const ObjectCalendar: React.FC<ObjectCalendarProps> = ({
199199
const color = colorField ? record[colorField] : undefined;
200200

201201
return {
202-
id: record.id || record._id || String(index),
202+
id: record.id || record._id || `event-${index}`,
203203
title,
204204
start: startDate ? new Date(startDate) : new Date(),
205205
end: endDate ? new Date(endDate) : undefined,

packages/views/src/ObjectGantt.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ export const ObjectGantt: React.FC<ObjectGanttProps> = ({
196196
const dependencies = dependenciesField ? record[dependenciesField] : [];
197197

198198
return {
199-
id: record.id || record._id || String(index),
199+
id: record.id || record._id || `task-${index}`,
200200
title,
201201
start: startDate ? new Date(startDate) : new Date(),
202202
end: endDate ? new Date(endDate) : new Date(),

packages/views/src/ObjectKanban.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,8 @@ export const ObjectKanban: React.FC<ObjectKanbanProps> = ({
214214
id: String(value),
215215
title: String(value),
216216
summary,
217-
cards: columnCards.map(record => ({
218-
id: record.id || record._id || String(Math.random()),
217+
cards: columnCards.map((record, idx) => ({
218+
id: record.id || record._id || `${value}-${idx}`,
219219
title: record[displayColumns[0]] || record.name || record.title || 'Untitled',
220220
description: displayColumns[1] ? record[displayColumns[1]] : undefined,
221221
data: record,

packages/views/src/ObjectMap.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ export const ObjectMap: React.FC<ObjectMapProps> = ({
267267
const description = mapConfig.descriptionField ? record[mapConfig.descriptionField] : undefined;
268268

269269
return {
270-
id: record.id || record._id || String(index),
270+
id: record.id || record._id || `marker-${index}`,
271271
title,
272272
description,
273273
coordinates,

0 commit comments

Comments
 (0)