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

StateManager.getScrollBarSize() fetches scrollbar-size lazily #2200



Copy link

screeny05 commented Sep 16, 2019

1. Why is this change necessary?

Calculating the Scrollbar-Size right at the pageload forces a reflow by the browser. To prevent this ~60ms js-block, we can fetch the scrollbar-size lazily.


2. What does this change do, exactly?

Change the private property StateManager._scrollBarSize to a private method StateManager._getScrollBarSize which uses a cache internally, so only one calculation is made.


  • StateManager.getScrollBarSize()
  • StateManager.getScrollBarWidth()
  • StateManager.getScrollBarHeight()

were changed to call this new function.

3. Describe each step to reproduce the issue or behaviour.

Use the Chrome DevTools to profile a shopware-shop. On pageload you will see a flamegraph like in the screenshot above.

4. Please link to the relevant issues (if any).

5. Which documentation changes (if any) need to be made because of this PR?

None, as the removed property was private.

6. Checklist

  • I have squashed any insignificant commits
  • I have read the contribution requirements and fulfil them.

This comment has been minimized.

Copy link

shopwareBot commented Sep 19, 2019


thank you for creating this pull request.
I have opened an issue on our Issue Tracker for you. See the issue link:

Please use this issue to track the state of your pull request.


This comment has been minimized.

Copy link

shyim commented Oct 2, 2019

Thanks for your Contribution! 💙

@shyim shyim added Accepted and removed Quick-Pick Scheduled labels Oct 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.