'd3.js: Pie chart within resizable div, height overflowing when expanding horizontally

When expanding the div only vertically, the chart remains entirely within the div since it has no available space to expand left and right. But when trying to expand it only horizontally, the chart starts to resize itself despite it not having the available height. leading to an overflow. I want it to behave just like the other case.

[preview] https://daffy-skinny-dirt.glitch.me

[code] https://glitch.com/edit/#!/daffy-skinny-dirt

Pie chart component is in src/components/PieChart

Pie chart is being loaded in src/pages/home



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source