Skip to content

Commit

Permalink
Code polish
Browse files Browse the repository at this point in the history
  • Loading branch information
KSDaemon committed Oct 8, 2024
1 parent b694196 commit 9a72c42
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,10 @@ function CartesianChart({
let granularity = granularityField?.split('.')[2];

if (!isPredefinedGranularity(granularity)) {
const granularityInfo = resultSet?.loadResponse.results[0].annotation.timeDimensions[granularityField]?.granularity;
granularity = minGranularityForIntervals(granularityInfo.interval, granularityInfo.offset || granularityFor(granularityInfo.origin));
const granularityInfo = resultSet?.loadResponse.results[0]?.annotation.timeDimensions[granularityField]?.granularity;
if (granularityInfo) {
granularity = minGranularityForIntervals(granularityInfo.interval, granularityInfo.offset || granularityFor(granularityInfo.origin));
}
}

const formatDate = useMemo(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ export function TimeListMember(props: ListMemberProps) {

const customGranularities = (member.type === 'time' && member.granularities) ?
member.granularities.map(g => g.name) : [];
const memberGranularities = (member.type === 'time' && member.granularities) ?
member.granularities.map(g => g.name).concat(PREDEFINED_GRANULARITIES) :
PREDEFINED_GRANULARITIES;
const memberGranularities = customGranularities.concat(PREDEFINED_GRANULARITIES);
const isGranularitySelectedMap = {};
memberGranularities.forEach((granularity) => {
isGranularitySelectedMap[granularity] = isSelected(granularity)
Expand Down

0 comments on commit 9a72c42

Please sign in to comment.