-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Fix issues in scrollable pane #4055
Fix issues in scrollable pane #4055
Conversation
@ThomasMichon are you ok with this? |
@@ -167,7 +167,6 @@ export class ScrollablePaneBase extends BaseComponent<IScrollablePaneProps, {}> | |||
} | |||
}, 1); | |||
} | |||
this.notifySubscribers(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should just move this call into the timeout.
c7c112e
to
9176014
Compare
* Fix infinite recursion in scrollable pane * Rush change * Fix root cause of infinite loop * Fixed issue with sticky headers not being added to stickyAbove * Remove ref for stickyContainer * Fix bad rebase
Re-wording the description here for clarity for future reference: It's possible to enter an infinite recursion in ScrollablePane:
The solution to this was to update This, however, unfurled a different bug in ScrollablePane which the infinite loop had masked: the top sticky header wouldn't properly be placed in |
Pull request checklist
$ npm run change
Description of changes
It's possible to enter an infinite recursion in scrollable pane. notifySubscribers is called from _onWindowResize, which is called from forceLayoutUpdate (callable from the parent item). This calls Sticky::_onScrollEvent, which updates the Sticky's state. Sticky::componentDidUpdate can call scrollablePane.addStickyHeader, which calls _addSticky, which then calls notifySubscribers, infinitely recursing. The solution to this was to update Sticky::_onScrollEvent to not check the current of conditions of isStickyTop and isStickyBottom, since it was causing them to constantly flip, causing setState to constantly get called.
This, however, unfurled a different bug in ScrollablePane which the infinite loop had masked: the top sticky header wouldn't properly be placed in stickyAbove on creation of the ScrollablePane, but the constant changing of isStickyTop and isStickyBottom eventually caused it to snap in place. By getting rid of stickyContainer and moving stickyAbove and stickyBelow to siblings of the children of the pane, this is fixed (it also removed the need for resizeContainer).
Focus areas to test
Scrollable Pane