preact
preact copied to clipboard
[WIP] Bugfix: Component's default render() should render nothing
Currently it uses Fragment as its implementation to reduce size, but Fragment renders props.children. This means that components inheriting from Component without providing their own render() method render their children by default.
Can we add a test for that so we don‘t regress when golfing? I might find an hour or two today to add one
Coverage increased (+0.07%) to 97.749% when pulling 603e7daf2fe7c52366505fdbadd218161d2f24fe on bugfix-component-default-render into cf635d5eb274c2fba4fc23c34ef9157b90d17e81 on master.
Tests are failing, and I think it's because Suspense assumed Component.prototype.render would render children.
@developit Is this still WIP? Maybe we can merge it in
I think we can merge. Only thing I was wondering is whether we wanted to hoist the function up as a constant (EMPTY_FUNC). Potentially useful for null callbacks?
I think we can merge. Only thing I was wondering is whether we wanted to hoist the function up as a constant (
EMPTY_FUNC). Potentially useful for null callbacks?
Feels good to me
@developit do you still wanna add the EMPTY_FUNC in this PR? Or is it ready? Can be added later as well.