Certainly possible I'm misinterpreting the code, but it appears as if _onEnterViewport is purposefully triggered if/when the tracked element does not exist. See https://github.com/yahoo/react-i13n/blob/master/src/libs/ViewportDetector.js#L56
In practice, I'm also noticing that components who's render return value ends up as null are being tracked as entering the viewport, but this seems counterintuitive.
contrived example:
const ConditionalComponent = (props) => {
return props.shouldRender ? <div>Yay!</div> : null;
};
const i13nConditionalComponent = createI13nNode(ConditionalComponent);
// triggers viewport as intended when in view
<ConditionalComponent shouldRender />
// still triggers viewport as maybe(?) unintended on init
<ConditionalComponent shouldRender={false} />
Certainly possible I'm misinterpreting the code, but it appears as if
_onEnterViewportis purposefully triggered if/when the tracked element does not exist. See https://github.com/yahoo/react-i13n/blob/master/src/libs/ViewportDetector.js#L56In practice, I'm also noticing that components who's render return value ends up as
nullare being tracked as entering the viewport, but this seems counterintuitive.contrived example: