runbox7 icon indicating copy to clipboard operation
runbox7 copied to clipboard

calculateWidthDependentElements function is called too often

Open shadowbas opened this issue 11 months ago • 1 comments

Describe the bug calculateWidthDependantElements causes a considerable slowdown. This is mostly due to the fact that it is called in ngDoCheck.

This computation is used to determine if buttons should be visible or collapsed into a collapsable dropdown. The components that depend on this computation can be found in the following screenshots.

Screenshots Image

Solution Instead of performing this calculation on ngDoCheck (which is run on every Angular re-render) it should be done whenever a resize of relevent elements occur. The relevant element being the container element in which the buttons are situated.

See https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver

Additional context Add any other context about the problem here.

shadowbas avatar Jan 29 '25 11:01 shadowbas

Yes that does seem a little ridiculous (title updated as misspelled the function name)

castaway avatar Jan 29 '25 14:01 castaway