Skip to content

Commit

Permalink
RC #291 - Updating FacetTimeline component to set new range when useR…
Browse files Browse the repository at this point in the history
…ange value is changed
  • Loading branch information
dleadbetter committed Aug 12, 2024
1 parent ab6071c commit b036c37
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/core-data/src/components/FacetTimeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,15 @@ const FacetTimeline = (props: Props) => {
}
}, [defaultMin, defaultMax, defaultRange]);

/**
* Sets the new range value based on the results of the `useRange` hook.
*/
useEffect(() => {
if (defaultRange && range && defaultRange.min !== range[0] && defaultRange.max !== range[1]) {
setRange([defaultRange.min, defaultRange.max]);
}
}, [defaultRange]);

/**
* Only render if we have a default min/max value.
*/
Expand Down

0 comments on commit b036c37

Please sign in to comment.