-
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
fix(Visibility): fix behaviour of reverse calls #2088
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2088 +/- ##
==========================================
- Coverage 99.76% 99.76% -0.01%
==========================================
Files 149 149
Lines 2601 2598 -3
==========================================
- Hits 2595 2592 -3
Misses 6 6
Continue to review full report at Codecov.
|
2013cb2
to
94c836a
Compare
94c836a
to
f0983a5
Compare
f0983a5
to
1e9e4a4
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.
Ready for review. Now the component's behaviour matches to SUI. I've also shipped some cleanups for tests there.
} | ||
|
||
firedCallbacks = [] | ||
occurredCallbacks = [] |
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 the original name here is more appropriate, firedCallbacks
.
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.
Restored 👍
} | ||
|
||
componentDidMount() { | ||
if (!isBrowser) return | ||
|
||
const { context, fireOnMount } = this.props | ||
|
||
context.addEventListener('scroll', this.handleScroll) | ||
if (fireOnMount) this.handleUpdate() | ||
context.addEventListener('scroll', this.handleUpdate) |
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.
nit: suggest keeping handleScroll
for the scroll handler. It makes it clear when/why it is called.
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.
This comes from #2091, this handler will also handle resize
event
@@ -26,67 +26,72 @@ const mockScroll = (top, bottom) => { | |||
} | |||
} | |||
|
|||
window.dispatchEvent(new Event('scroll')) | |||
domEvent.scroll(window) |
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.
❤️
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.
Good to merge after the small naming updates.
@levithomason I've restored naming, as you approved changes in this PR, I merged it 💥 |
Released in |
I'm working on #2070, but it can't be finished without changes there.
We have wrong behaviour for
*reverse
callbacks and it's easy to show, see GIFs. We fire them always, but in fact they should be called in the oppositite condition.SUI
Click to expand
SUIR
Click to expand