-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
feat(explore-attr-breakdowns): Using new useChartXRangeSelection hook #103814
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
base: abdk/useChartXrangeSelection
Are you sure you want to change the base?
feat(explore-attr-breakdowns): Using new useChartXRangeSelection hook #103814
Conversation
| ); | ||
| boxSelectOptions.clearSelection(); | ||
| }, [boxSelectOptions, router]); | ||
| clearSelection(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Falsy check fails for zero timestamp values
The condition checks if startTimestamp or endTimestamp are falsy, but since these are numeric timestamps, a value of 0 (Unix epoch) is valid yet falsy in JavaScript. This causes the function to incorrectly return early when the selection includes timestamp 0, preventing zoom functionality for that edge case. The check needs to explicitly test for null or undefined rather than relying on falsy evaluation.
| saveOnZoom: true, | ||
| }); | ||
|
|
||
| const {groupName} = useWidgetSyncContext(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useWidgetSyncContext gets called on line 141. Can we just get the groupName from there? Unless there's a reason we need to create another context?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Laser eyes 👁️🗨️
| boxSelectOptions={boxSelectOptions} | ||
| triggerWrapperRef={triggerWrapperRef} | ||
| /> | ||
| {index === 0 ? <AttributeComparisonCTA>{widget}</AttributeComparisonCTA> : widget} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Chart clicks clear selection unexpectedly
The ChartWrapper no longer prevents selection clearing when clicked. The old useChartBoxSelect hook checked if clicks were inside chartWrapperRef before clearing selection, but the new useChartXRangeSelection hook uses data-explore-chart-selection-region attributes instead. The ChartWrapper lacks this attribute, causing clicks on the chart to clear the selection, breaking the previous behavior where users could interact with the chart without losing their selection.
useChartXRangeSelectionto enable range selection only in explore chartsuseBoxChartSelectionhook