Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(explore): Fix generic X-axis time grain disappearing #21484

Merged
merged 1 commit into from
Sep 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,12 @@ const time_grain_sqla: SharedControlConfig<'SelectControl'> = {
if (isAdhocColumn(xAxisValue)) {
return true;
}
if (isPhysicalColumn(xAxisValue)) {
return !!xAxis?.options?.[xAxisValue]?.is_dttm;
if (isPhysicalColumn(xAxisValue) && Array.isArray(xAxis?.options)) {
for (let i = 0; i < xAxis.options.length; i += 1) {
if (xAxis.options[i].column_name === xAxisValue) {
return !!xAxis.options[i].is_dttm;
}
}
}
Comment on lines -200 to 206
Copy link
Member

@zhaoyongjie zhaoyongjie Sep 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nits:

Suggested change
if (isPhysicalColumn(xAxisValue)) {
return !!xAxis?.options?.[xAxisValue]?.is_dttm;
if (isPhysicalColumn(xAxisValue) && Array.isArray(xAxis?.options)) {
for (let i = 0; i < xAxis.options.length; i += 1) {
if (xAxis.options[i].column_name === xAxisValue) {
return !!xAxis.options[i].is_dttm;
}
}
}
if (isPhysicalColumn(xAxisValue)) {
return !!(xAxis?.options ?? []).find(col => col.column_name === xAxisValue)?.is_dttm;
}

return false;
},
Expand Down