-
Notifications
You must be signed in to change notification settings - Fork 2
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
Lookup event emitter on scroll #253
Conversation
guergana
commented
Nov 3, 2020
- an event is emitted from Lookup when user scrolls in the LookupMenu that contains the first and last indexes of visible elements
- added a browser test
04ac73e
to
d6ea8a1
Compare
I am aware that the scroll event might need to be throttled. I am not sure about what is the best approach for doing this in vue. Should I use a setTimeout, is 300 a good delay? Making the event passive already improves the performance. |
That's great thinking! IMO maybe a debounce would work even better for this kind of task (for anyone interested in more context, see: https://redd.one/blog/debounce-vs-throttle).
Whichever you choose, it would probably be best to make the chosen function reusable, or even rely on an external lib like lodash (I'm more of a less deps better approach, but it's really a personal choice in this case, as long as the library is maintained and well supported) see this stack overflow thread for deets. |
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.
Blocking until implementation of throttle / debounce.
I think we used a debounce in data bridge. I'll look it up |
Here we are using lodash's debounce: |
Will use debounce then. Thanks for the input @micgro42 and @itamargiv |
9d6370b
to
16466af
Compare
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.
A few minor changes and we might be good to go. Looking great otherwise!
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.
Requesting changes because of the ref
vs querySelectorAll
comment.
16466af
to
2f0f1ff
Compare
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.
Requesting changes, because of the ref
business. I think the PR is almost there 👍
2f0f1ff
to
b7bd74f
Compare
a53ed72
to
2c62163
Compare
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.
Looking like it's going well, I will approve on my side, but agree with @tzhelyazkova that we should use refs where possible.
2c62163
to
396d684
Compare
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.
Approving since the ref
thing was addressed.
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.
:( Sorry, it really is good to go, it's really just that small docs thing I approved too soon
+ an event is emitted from Lookup when user scrolls in the LookupMenu that contains the first and last indexes of visible elements + added a browser test
396d684
to
f460ec1
Compare