tl;dr: This release contains a lot of bug fixes in many areas and we encourage everyone to upgrade. We're confident that this is the last rc
release before marking X as stable.
It's time for another Preact release 🎉 We've spent the past weeks on make
Preact as robust as we can. Most fixes are ones you all submitted to our
tracker. This is super awesome and we wouldn't be where we are without all your
help!
On top of countless fixes, a few minor features found their way into the
package like isValidElement
that can be used to check if something is valid to
render, meaning it's a valid child that was created by h
/createElement
.
The test utils also received much love and we're very impressed with how quickly
@robertknight was able to land support for async
callbacks and nested calls
to act
💯 This is useful in cases where triggering an effect or state change
involves async steps, such as waiting for a fetch
call to resolve.
Preact Devtools are coming
We think it'd be good to give a setSate of the union here about where we are
with the devtools. As many of you are aware we've always depended on the
react-devtools
extension for a long time now. We were very excited to
integrate with version 4, not just because of the new featureset, but also
because the adapter and protocol is so much better than before.
We got very far, but despite of all our efforts we ran into blocker issues with
the expected order of events that need to be sent to the extension. Our
internals differ quite a bit and after trying for weeks to get it right we
ultimately went back to the drawing board.
It became clear that just writing our own extension would be less resource
intensive and would make it easier for us to maintain. It's pre-alpha right now,
but we expect to mature in the coming weeks/month. Here is a screenshot as a
little sneak peek:
Very early pre-alpha preview of preact-devtools
We'll keep you posted! Here is the full list of changes in this release:
Features
- Add
isValidElement
to core (#1861, thanks @marvinhagemeister) - Throw error when passing plain objects as
children
(#1858, thanks @marvinhagemeister) - Add support for
form
attribute onbuttons
andinputs
(#1863, thanks @sventschui) - Warn when calling
setState
in aconstructor
(#1857, thanks @marvinhagemeister) - Implement support for async
act
callbacks and nested calls toact
(#1854, thanks @robertknight)
Bug Fixes
- Fix nested
setState
calls with accuratethis.state
(#1748, thanks @JoviDeCroock) - Fix
useImperativeHandle
handles after rendering (#1909, thanks @JoviDeCroock) - Fix
shouldComponentUpdate
leading to invalid DOM without children (#1888, thanks @JoviDeCroock) - Add
shouldComponentUpdate
check forcontext.Consumer
(#1901, thanks @cristianbote) - Fix
replaceNode
argument not always replacing node (#1900, thanks @JoviDeCroock) - Fix incorrect dom pointer with
shouldComponentUpdate
(#1871, thanks @marvinhagemeister) - Fix IE11 regressions (#1856, thanks @marvinhagemeister)
- Fix
undefined
styles not being cleared (#1853, thanks @marvinhagemeister) - Fix
act
not flushing effects/updates if global effect/update queues are non-empty beforeact
call (#1851, thanks @robertknight) - Support adding
refs
tomemo
'ed components (#1860, thanks @sventschui) - Tag
forwardRef
&memo
proxy components as React components (#1844, thanks @developit) - Fix IE11 not setting initial
select
value (#1838, thanks @marvinhagemeister) - Avoid accessing
fn.prototype
where possible (#1835, thanks @developit) - Only destroy DOM on first render (#1832, thanks @marvinhagemeister)
- Flatten children array as it is diffed (#1716, thanks @andrewiggins)
- Optimize creating array of childrens (#1743, thanks @Connormiha)
Typings
- Fix
compat
types (#1752, thanks @marvinhagemeister) - Add
key
to all jsx elements (#1887, thanks @marvinhagemeister) - Fix type definitions for
getDerivedStateFromProps
andgetDerivedStateFromError
(#1874, thanks @38elements) - Add
VNode.constructor
to internal type definitions (#1810, thanks @38elements)
Maintenance
- Add info message about react-devtools v4 (#1908, thanks @marvinhagemeister)
- Add back Code of Conduct from Preact 8 branch (#1897, thanks @marvinhagemeister)
- Make source files non-executable (#1894, thanks @jridgewell)
- Skip
form
attribute test on IE11 (#1868, thanks @marvinhagemeister) - Re-enable coveralls (#1867, thanks @marvinhagemeister)
- Disable coveralls until their outage is resolved (#1866, thanks @marvinhagemeister)
- Delete .flowconfig (#1855, thanks @38elements)
- Remove Flow type definition (#1846, thanks @38elements)
- Remove a duplicate test in render tests (and add additional child node checks) (#1847, thanks @OrKoN)
- Exclude Edge from running devtool tests (#1839, thanks @marvinhagemeister)
- Remove double build for TravisCI (#1837, thanks @cristianbote)
- Exclude devtools tests from coverage (#1808, thanks @marvinhagemeister)
- Fix test in IE by sorting attributes. (#1836, thanks @marvinhagemeister)