You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Having list items with heavy js usage on initialization will lead to a buggy scroll experience.
As example I had a VirtualList with 8 columns and each item was using some jquery code to call a function from semantic ui: window.$(cardItem).children('.inlinepopup').popup();
The popup was called when the item got initialized the first time, but when I scrolled down and up it doesnt. Therefore I wrapped it in a onMount function. That lead to a very laggy scroll experience.
I worked arround this by introducing a finished variable, which tells if the user is still scrolling or has finished/paused for at least 800ms:
VirtualList.svelte
exportletfinished=true;letlastUpdate=Date.now();asyncfunctionhandle_scroll(){finished=false;// … whole existing handle_scroll() function herelastUpdate=Date.now();}
$: {if(!finished&&(lastUpdate+800)<Date.now()){finished=true;}elseif(!finished){setTimeout(()=>{lastUpdate=lastUpdate-1},900);}}
Having list items with heavy js usage on initialization will lead to a buggy scroll experience.
As example I had a
VirtualList
with 8 columns and each item was using some jquery code to call a function from semantic ui:window.$(cardItem).children('.inlinepopup').popup();
The popup was called when the item got initialized the first time, but when I scrolled down and up it doesnt. Therefore I wrapped it in a
onMount
function. That lead to a very laggy scroll experience.I worked arround this by introducing a
finished
variable, which tells if the user is still scrolling or has finished/paused for at least 800ms:VirtualList.svelte
App.svelte
ListItem.svelte
If this is a good idea, I could open an PR.
Edit: maybe
finished
should beisScrolling
instead with inverse boolean.The text was updated successfully, but these errors were encountered: