Skip to content

Commit

Permalink
improve SchedulerMoment keys
Browse files Browse the repository at this point in the history
  • Loading branch information
jvllmr committed Jul 26, 2024
1 parent 40436c5 commit a54ec82
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/SchedulerBody/SchedulerBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ function SchedulerBodyRow<TData, TResource>({
.map(([moment, distance], momentIndex) => {
return (
<SchedulerMoment
key={`moment_top_${moment.toISOString()}`}
key={`scheduler_moment_top_${resourceId}_${momentIndex}`}
displayUnit={controller.displayUnit}
height={rowHeight}
moment={moment}
Expand All @@ -212,6 +212,7 @@ function SchedulerBodyRow<TData, TResource>({
firstSelectedMoment={controller.firstSelectedMoment}
lastSelectedMoment={controller.lastSelectedMoment}
selectedResource={controller.selectedResource}
momentIndex={momentIndex}
loss={
momentIndex === 0
? firstMomentLoss
Expand Down
9 changes: 6 additions & 3 deletions src/SchedulerBody/SchedulerMoment/SchedulerMoment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export interface SchedulerMomentProps<TData, TResource> {
isSelected?: boolean;
momentStyle?: MomentStyleFn<TData, TResource>;
nextMoment?: Dayjs;
momentIndex: number;
}

export const SchedulerMoment = <TData, TResource>(
Expand Down Expand Up @@ -86,7 +87,6 @@ export const SchedulerMoment = <TData, TResource>(
return useMemo(
() => (
<Paper
key={`${props.moment.toISOString()}_${props.resourceId}`}
radius={0}
withBorder
h={props.height}
Expand All @@ -101,7 +101,10 @@ export const SchedulerMoment = <TData, TResource>(
>
{props.inSub ? null : (
<Flex>
<SchedulerSubMoments {...props} />
<SchedulerSubMoments
{...props}
key={`scheduler_sub_moments_top_${props.resourceId}_${props.momentIndex}`}
/>
</Flex>
)}
</Paper>
Expand All @@ -124,7 +127,7 @@ export const SchedulerSubMoments = <TData, TResource>(
return (
<SchedulerMoment
{...props}
key={`sub_${myMoment.toISOString()}_${props.resourceId}`}
key={`scheduler_sub_moment_${props.resourceId}_${props.momentIndex}.${n}`}
isTop
isBottom
isLeft={n === 0}
Expand Down

0 comments on commit a54ec82

Please sign in to comment.