Skip to content

Commit

Permalink
fix a bug in facet range picker where the zoom in button would not be…
Browse files Browse the repository at this point in the history
… disabled if min or max were set to 0
  • Loading branch information
jrchudy committed Apr 5, 2024
1 parent 6cb2d83 commit 679e826
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/faceting/facet-range-picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -708,11 +708,15 @@ const FacetRangePicker = ({
});
}

function _isValueDefined(val: any) {
return val !== undefined && val !== null;
}

// disable zoom in if histogram has been zoomed 20+ times or the current range is <= the number of buckets
const disableZoomIn = (min: RangeOptions['absMin'], max: RangeOptions['absMax']) => {
let limitedRange = false;

if (min && max) {
if (_isValueDefined(min) && _isValueDefined(max)) {
if (isColumnOfType('int')) {
limitedRange = ((max as number) - (min as number)) <= numBuckets;
} else if (isColumnOfType('date')) {
Expand Down

0 comments on commit 679e826

Please sign in to comment.