KanoComputing / kano-code

πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»Kano Code
https://world.kano.me
GNU General Public License v2.0
16 stars 5 forks source link

Clock part periodically triggers large editor repaints #1819

Open keithclark opened 4 years ago

keithclark commented 4 years ago

When adding a clock part to a creation the preview stutters once a second. This is really apparent on lower-end hardware, like the PI3 Kits. Adding another clock makes the problem worse.

Devtools shows the clock part is triggering a complete repaint of the block editor whenever the inline <kc-clock-display> component updates (see the gif below. I wish GitHub would let me upload videos!). Profiling this on the PI3 kit points to these repaint as the cause of the stuttering.

paint-flash

To prove this I added position: absolute to the <kc-part-item-list> elements to prevent them from triggering reflows (and also breaks UI layout). This limits repaints to the correct areas and the PI happily ticks away at a constant frame rate...

paint-flash-fix

This paint flashing also happens briefly when switching to the part rename control, so this may not be limited to the clock part.