tbranyen/diffhtml

createSideEffect runs on re-render even if already mounted

tbranyen opened this issue · 3 comments

The createSideEffect function allows one to hook into various lifecycle states. When using the mount lifecycle, I noticed that re-rendering the entire tree causes a re-mount when a component is already mounted.

createSideEffect(() => {
  console.log('Called even when already mounted');
});

I believe this is also causing a problem with the patching layer, as it is looking for previously defined nodes that no longer exist:

image

This seems to specifically affect nested components only.

Fixed in: #282