Skip to content

Commit

Permalink
Update chart dimensions to update on chart height resize
Browse files Browse the repository at this point in the history
  • Loading branch information
maryamkaka committed Sep 12, 2023
1 parent afa1e1b commit d551de7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions packages/polaris-viz/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

<!-- ## Unreleased -->

- Fixed issue where chart would not resize on height change

## [9.10.7] - 2023-09-06

### Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ export function ChartDimensions({

const updateDimensions = useCallback(() => {
if (
previousEntry?.contentRect.width === entry?.contentRect.width ||
(previousEntry?.contentRect.width === entry?.contentRect.width &&
previousEntry?.contentRect.height === entry?.contentRect.height) ||
entry == null
) {
return;
Expand All @@ -65,7 +66,7 @@ export function ChartDimensions({
const {x, y} = entry.target.getBoundingClientRect();

setChartDimensions({width, height, x, y: y + window.scrollY});
}, [entry, previousEntry?.contentRect.width]);
}, [entry, previousEntry?.contentRect]);

const debouncedUpdateDimensions = useDebouncedCallback(() => {
updateDimensions();
Expand Down

0 comments on commit d551de7

Please sign in to comment.