Closed martinschmelzer closed 5 years ago
We could add an option to disable the lazy loading functionality. This should solve your problem.
We're also having this issue, loading DCL exercises inside of an iFrame. Since the iFrame is a fixed height, I think this messes with react-lazyload
's calculations and it never tries to load the exercise. This appears to be a known issue with react-lazyload
, see this issue on their tracker.
The lazy load also appears not to work if re-rendering into an area that is already visible on the page: it stays stuck on the placeholder until I scroll again. Ideally DCL would detect that it's already rendered in a visible area and load itself immediately.
An option to turn off lazy loading would be greatly appreciated and is probably the easiest solution for now. In the case of one commenter on the above react-lazyload
issue, they fixed lazy loading properly by "replac[ing] it [with] a custom component based on IntersectionObserver with similar reduced API," but that sounds like a bigger fix.
Submitted a PR to add an option to disable lazy-loading, which should fix these issues: https://github.com/datacamp/datacamp-light/pull/136
When creating a bookdown document using your example exercises, the first exercise loads normally. The others do not load when scrolling them into the viewport. It is like the "inViewport" event is not triggered. When generating basic RMarkdown document with several exercises it works as expected.