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
The purpose of that little bit of code is to try and find a balance between locking up but having no re-layouts, or not locking up and having no a bunch of re-layouts.
If there are slots I do as much dom injections as I can in 250ms and then throw the next batch of work on the next tick.
If I change it to requestAnimationFrame instead of setTimeout it might actually take more time for the whole page to settle down. Since I think setTimeout can fire faster than requestAnimationFrame.
I will give it a shot though and see how it affects things.
My "optimization" was actually causing some weird race conditions switching to requestAnimationFrame fixed those race conditions. It still has pretty gnarly FOUC.
I'm still looking for a solution to that. My best solution is to do some server side rendering, but that's a big piece of code I'd rather not attack until I need to.
This is just a shot in the dark, but it looks like https://github.com/allain/x-widget/blob/main/src/later.mjs#L11 and https://github.com/allain/x-widget/blob/main/src/x-widget.mjs#L65
should be RequestAnimationFrame?
The text was updated successfully, but these errors were encountered: