Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

calculateWidthDependentElements function is called too often #1656

Open
shadowbas opened this issue Jan 29, 2025 · 1 comment
Open

calculateWidthDependentElements function is called too often #1656

shadowbas opened this issue Jan 29, 2025 · 1 comment
Labels
enhancement New feature or request P2-high

Comments

@shadowbas
Copy link
Contributor

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.

@gtandersen gtandersen added enhancement New feature or request P2-high labels Jan 29, 2025
@castaway castaway changed the title calculateWidthDependantElements function is called too often calculateWidthDependentElements function is called too often Jan 29, 2025
@castaway
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request P2-high
Projects
None yet
Development

No branches or pull requests

3 participants