diff --git a/package-lock.json b/package-lock.json index 006f73ee..8b930f28 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7244,6 +7244,11 @@ "setimmediate": "1.0.5" } }, + "tiny-queue": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/tiny-queue/-/tiny-queue-0.2.1.tgz", + "integrity": "sha1-JaZ/LG4lOyypQZd7XvdELvl6YEY=" + }, "tmp": { "version": "0.0.31", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.31.tgz", diff --git a/package.json b/package.json index 5f43f8f2..f039a99d 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,7 @@ "svelte-loader": "^2.3.3", "svelte-transitions": "^1.1.1", "svgo": "^1.0.3", + "tiny-queue": "^0.2.1", "uglifyjs-webpack-plugin": "^1.1.5", "url-search-params": "^0.10.0", "webpack": "^3.10.0", diff --git a/routes/_components/pseudoVirtualList/PseudoVirtualList.html b/routes/_components/pseudoVirtualList/PseudoVirtualList.html index c179ab73..ed3cb403 100644 --- a/routes/_components/pseudoVirtualList/PseudoVirtualList.html +++ b/routes/_components/pseudoVirtualList/PseudoVirtualList.html @@ -7,7 +7,8 @@ makeProps="{{makeProps}}" key="{{wrappedItem.item}}" intersectionObserver="{{intersectionObserver}}" - hide="{{shouldHide(wrappedItem.item, $intersectionStates)}}" + isIntersecting="{{isIntersecting(wrappedItem.item, $intersectionStates)}}" + isCached="{{isCached(wrappedItem.item, $intersectionStates)}}" height="{{getHeight(wrappedItem.item, $intersectionStates)}}" /> {{/each}} @@ -35,7 +36,7 @@ let intersectionStates = this.store.get('intersectionStates') let keys = Object.keys(intersectionStates) for (let key of keys) { - intersectionStates[key].isIntersecting = false + intersectionStates[key].isCached = true } this.store.setForRealm({intersectionStates: intersectionStates}) @@ -60,8 +61,11 @@ } }, helpers: { - shouldHide(key, $intersectionStates) { - return !!($intersectionStates[key] && !$intersectionStates[key].isIntersecting) + isIntersecting(key, $intersectionStates) { + return !!($intersectionStates[key] && $intersectionStates[key].isIntersecting) + }, + isCached(key, $intersectionStates) { + return !!($intersectionStates[key] && $intersectionStates[key].isCached) }, getHeight(key, $intersectionStates) { return $intersectionStates[key] && $intersectionStates[key].rect.height diff --git a/routes/_components/pseudoVirtualList/PseudoVirtualListItem.html b/routes/_components/pseudoVirtualList/PseudoVirtualListItem.html index 0c3df6a0..578b71ab 100644 --- a/routes/_components/pseudoVirtualList/PseudoVirtualListItem.html +++ b/routes/_components/pseudoVirtualList/PseudoVirtualListItem.html @@ -1,9 +1,9 @@