You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I'm using this module to track an element at the top of the page (and so visible by default).
In the first load of the page this component always returns false and then the correct true, while if I reload the page when the component is not visible by default (i.e. if I reload while i'm in the middle of the page) I get only false which is correct.
Edit: Okay, I checked the code and I see that the first false makes sense, since it's the default state, and I don't get a second value when I refresh while not seeing the element because the state remain false. This is quite a tricky thing, because I have an animation that triggers when isVisible === false, and so happens to trigger in the first load because of the default state. I tried to ignore that state but if a refresh happens in the middle of the page then the animation won't trigger.
I think allowing to set the initial state of the component could be an interesting solution, couldn't it?
The text was updated successfully, but these errors were encountered:
dgopsq
changed the title
Odd behaviour with an element visible right on top.
Allowing to set the initial state of the component
May 24, 2018
Hello, I'm using this module to track an element at the top of the page (and so visible by default).
In the first load of the page this component always returns
false
and then the correcttrue
, while if I reload the page when the component is not visible by default (i.e. if I reload while i'm in the middle of the page) I get onlyfalse
which is correct.You can see a replica here, and here's the code.
Edit: Okay, I checked the code and I see that the first
false
makes sense, since it's the default state, and I don't get a second value when I refresh while not seeing the element because the state remainfalse
. This is quite a tricky thing, because I have an animation that triggers whenisVisible === false
, and so happens to trigger in the first load because of the default state. I tried to ignore that state but if a refresh happens in the middle of the page then the animation won't trigger.I think allowing to set the initial state of the component could be an interesting solution, couldn't it?
The text was updated successfully, but these errors were encountered: