-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
[v2] add listener to ScrollCaptor, even when no scroll is available on mount #2861
Conversation
👍 Got a vote from me. I'm currently forcing the height to be smaller than I know most results will be. |
+1 |
3 similar comments
+1 |
+1 |
+1 |
@pyreta this is a good idea, though I worry about binding a listener for every menu; especially when many won't have need for it. What about using a |
For those adding |
…mount. The commit is a bugfix copied from JedWatson#2861
Hey @jossmac, is there anything I can help with to get this issue resolved? Would investigating the |
@pyreta @Kemosabert if you can resolve the conflicts I'll merge it. DW about the rest. |
cb1c574
to
7c61e0f
Compare
@jossmac @Kemosabert conflicts have been resolved. Ready to merge! |
7c61e0f
to
05a7fe3
Compare
Not sure, sorry mate. I don't have publishing permission. |
Is there anyone else experiencing issues with the scroll not working after this merge ? |
Hi everyone! rollback to 3.0.4 fixes any problems with scroll, but causes warnings about old lifecycle methods Any thoughts? |
Current Behavior
The
onMenuScrollToBottom
callback will only fire if the dropdown menu is scrolling on mount.Proposed Changes
The
onMenuScrollToBottom
callback always fires, regardless of whether or not the dropdown menu was scrollable on mount.Why Change?
A dropdown menu may render more options after mounting and therefore event listeners may need to be listening for scroll events.
Use case
In a project I'm working on, I'm creating a dropdown supporting pagination that loads asynchronously. When I mount my
Select
component, my initial state is empty. Once the user starts typing, an async request is made loading my state with options, and showing them in the dropdown. However since the dropdown mounted with no options to start with, theScrollCaptor
is not listening for scroll events. This prevents me from being able to load the next page on bottom scroll after loading options asynchronously.CodeSandbox Example
You can see an example here where opening the dropdown with options already loaded allows for the
onMenuScrollToBottom
callback to log "bottom" in the console. However if you clear the options before opening the dropdown, the callback will not fire after options have loaded.