fixup 3dc93436: immediately render a chunk if ScrollY>0

This commit is contained in:
tophf 2017-04-27 22:12:32 +03:00
parent 68d2aeba69
commit 77ffd3004d

View File

@ -104,9 +104,10 @@ function showStyles(styles = []) {
.map(style => ({name: style.name.toLocaleLowerCase(), style})) .map(style => ({name: style.name.toLocaleLowerCase(), style}))
.sort((a, b) => (a.name < b.name ? -1 : a.name == b.name ? 0 : 1)); .sort((a, b) => (a.name < b.name ? -1 : a.name == b.name ? 0 : 1));
let index = 0; let index = 0;
const shouldRenderAll = (history.state || {}).scrollY > window.innerHeight; const scrollY = (history.state || {}).scrollY;
const shouldRenderAll = scrollY > window.innerHeight;
const renderBin = document.createDocumentFragment(); const renderBin = document.createDocumentFragment();
if (shouldRenderAll) { if (scrollY) {
renderStyles(); renderStyles();
} else { } else {
requestAnimationFrame(renderStyles); requestAnimationFrame(renderStyles);