fix(explore): Fix generic X-axis time grain disappearing#21484
Merged
zhaoyongjie merged 1 commit intoSep 16, 2022
Conversation
zhaoyongjie
reviewed
Sep 16, 2022
Member
zhaoyongjie
left a comment
There was a problem hiding this comment.
After the option is changed from an Object to an Array, we have to loop through the entire Array. This is an O(n) operation.
Comment on lines
200
to
206
| } | ||
| 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; | ||
| } | ||
| } | ||
| } |
Member
There was a problem hiding this comment.
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; | |
| } |
zhaoyongjie
approved these changes
Sep 16, 2022
Member
zhaoyongjie
left a comment
There was a problem hiding this comment.
Merged this PR first because Time Grain blocked testing others' fixes. @codyml thanks for the quick fixing!
jinghua-qa
pushed a commit
to preset-io/superset
that referenced
this pull request
Sep 19, 2022
(cherry picked from commit 324e997)
9 tasks
qfcwell
pushed a commit
to qfcwell/superset
that referenced
this pull request
May 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SUMMARY
In #21315, I refactored shared controls so feature flag checking for drag and drop was done in React render instead on module load. As part of that, I modified the config object's
optionsproperty to be an array instead of an object for some DnD shared controls, because non-DnD versions expected an array and I wanted to merge DnD and non-DnD config objects. But, I missed a place where avisibilityfunction expected an object, causing the Time Grain control to not appear whenGENERIC_CHART_AXESis enabled. This PR fixes that issue.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before:

After:

TESTING INSTRUCTIONS
Time Grainappears for charts supporting generic X-axis whenGENERIC_CHART_AXESis enabled.ADDITIONAL INFORMATION
GENERIC_CHART_AXES