mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
Merge pull request #413 from YunoHost/fix-app-catalog-rendering
ugly fix LazyRenderer bug
This commit is contained in:
commit
ddd268cbb9
1 changed files with 12 additions and 1 deletions
|
@ -27,8 +27,19 @@ export default {
|
||||||
mounted () {
|
mounted () {
|
||||||
let unrenderTimer
|
let unrenderTimer
|
||||||
let renderTimer
|
let renderTimer
|
||||||
|
|
||||||
this.observer = new IntersectionObserver(entries => {
|
this.observer = new IntersectionObserver(entries => {
|
||||||
if (entries[0].isIntersecting) {
|
let intersecting = entries[0].isIntersecting
|
||||||
|
|
||||||
|
// Fix for weird bug when typing fast in app search or on slow client.
|
||||||
|
// Intersection is triggered but even if the element is indeed in the viewport,
|
||||||
|
// isIntersecting is `false`, so we have to manually check this…
|
||||||
|
// FIXME Would be great to find out why this is happening
|
||||||
|
if (!intersecting && this.$el.offsetTop < window.innerHeight) {
|
||||||
|
intersecting = true
|
||||||
|
}
|
||||||
|
|
||||||
|
if (intersecting) {
|
||||||
clearTimeout(unrenderTimer)
|
clearTimeout(unrenderTimer)
|
||||||
// Show the component after a delay (to avoid rendering while scrolling fast)
|
// Show the component after a delay (to avoid rendering while scrolling fast)
|
||||||
renderTimer = setTimeout(() => {
|
renderTimer = setTimeout(() => {
|
||||||
|
|
Loading…
Reference in a new issue