jahilldev / component-elements

Create a custom element from any component with these tiny functions (2KB GZipped, ~1KB Brotli). Preact and React currently supported
MIT License
89 stars 7 forks source link

Preactement: avoid rerender on hydrate #30

Closed naltatis closed 3 weeks ago

naltatis commented 3 weeks ago

Currently, preactement removes existing children when hydrating. This can lead to flicker and reflow. Skipping the innerHTML = '' should be perfectly fine. I'm using this modified version for a couple of month now in a project without issues. I would like to see this change in this repo as well.

All the best, naltatis

jahilldev commented 3 weeks ago

Hey @naltatis,

I've just published v1.9.0 with your changes: https://github.com/jahilldev/component-elements/releases/tag/preactement%401.9.0

I bumped the minor as some might be relying on innerHTML = '', but can't think of why right now. Even so, kinda a breaking change, so 1.9.0 it is!

Thanks again 👍

naltatis commented 3 weeks ago

Thanks for merging and the quick release 🤘