Skip to content

Commit

Permalink
review: better readability
Browse files Browse the repository at this point in the history
  • Loading branch information
logeekal committed Jul 2, 2024
1 parent 1c07c65 commit 801c314
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ const ActionsComponent: React.FC<ActionProps> = ({
}, [activeStep, incrementStep, isTourAnchor, isTourShown, onEventDetailsPanelOpened]);

const noteIds = useMemo(
() => (eventIdToNoteIds ? eventIdToNoteIds[eventId] || emptyNotes : emptyNotes),
() => eventIdToNoteIds?.[eventId] ?? emptyNotes,
[eventIdToNoteIds, eventId]
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const useNotesInFlyout = (args: UseNotesInFlyoutArgs) => {
const dispatch = useDispatch();

const noteIds: string[] = useMemo(
() => (eventIdToNoteIds && eventId && eventIdToNoteIds[eventId]) || EMPTY_STRING_ARRAY,
() => (eventId && eventIdToNoteIds?.[eventId]) || EMPTY_STRING_ARRAY,
[eventIdToNoteIds, eventId]
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,14 @@ export const TimelineDataTableComponent: React.FC<DataTableProps> = memo(
};
}, [expandedDoc]);

const finalRenderCustomBodyCallback = useMemo(() => {
return enabledRowRenderers.length > 0 ? renderCustomBodyCallback : undefined;
}, [enabledRowRenderers.length, renderCustomBodyCallback]);

const finalTrailControlColumns = useMemo(() => {
return enabledRowRenderers.length > 0 ? trailingControlColumns : undefined;
}, [enabledRowRenderers.length, trailingControlColumns]);

return (
<StatefulEventContext.Provider value={activeStatefulEventContext}>
<StyledTimelineUnifiedDataTable>
Expand Down Expand Up @@ -449,12 +457,8 @@ export const TimelineDataTableComponent: React.FC<DataTableProps> = memo(
showMultiFields={true}
cellActionsMetadata={cellActionsMetadata}
externalAdditionalControls={additionalControls}
renderCustomGridBody={
enabledRowRenderers.length > 0 ? renderCustomBodyCallback : undefined
}
trailingControlColumns={
enabledRowRenderers.length > 0 ? trailingControlColumns : undefined
}
renderCustomGridBody={finalRenderCustomBodyCallback}
trailingControlColumns={finalTrailControlColumns}
externalControlColumns={leadingControlColumns}
cellContext={cellContext}
/>
Expand Down

0 comments on commit 801c314

Please sign in to comment.