Changelog History
Page 5
-
v10.0.0-alpha.3 Changes
April 02, 2019🚀 It's time for another Preact X release 🎉 The past weeks were very productive and we're very happy to have been able to improve Preact on many fronts.
mjs
is no more 💯 ✅🚀 We are very happy to have removed our
.mjs
bundles and are back with standard.js
files. This was a common error when trying out the alpha withwebpack
because the resolution formjs
files is different. We're very thankful for @lukeed who stepped up and created a workaround with a custom webpack plugin that we have been referring to. But we all knew that we wanted to correct that with our next release and make Preact work out of the box with webpack again. This release does just that and you can safely removewebpack-modules
👍Developer Experience Enhancements 🛠
🚀 For this release we spent a few days working on improving the developer experience when writing Preact apps. For that we added more warnings to
preact/debug
which should catch some common issues you may have run into. These will be visible in your browsers console 🎉- Warn on double encoding of JSX literals and other invalid nodes passed to
createElement/h
- Warn when an event handler is not a
function
- Warn when the container node passed to
render()
doesn't exist in the DOM - 👀 Warn on invalid dependencies passed to
useEffect/useLayoutEffect
Here is an example:
Other notable changes
Thanks to the stunningly beautiful "people demo" that @phaux contributed we were able to catch two issues when using Preact together with
mobx-react
. Our compat shim is now on a level wheremobx-preact
isn't needed anymore (it was lagging behind in terms of features compared tomobx-react
).What's next
🚀 We brought in the first batches of reconciler fixes but have a few pending changes left to do. These mainly include fixes that will make
Fragment
support rock solid and an enhancements tocreateContext
. When these are stable we'll move forward to a beta release 👍 We even have some cool performance improvements in the pipeline 🤫You all are amazing!
🍱 As always we'd like to take time to thank everyone who has filed issues or participated in discussion. The issues in particular are much higher quality than just a few months ago. We've received quite a few comments on twitter or in person from friends working on other OSS projects that they love our community and the positivity ours is known for. Just wanted to pass on the praise to you all 🎉 ❤️
Without further ado, here is the full change set:
🔋 Features
- ➕ Add warnings for invalid
useEffect/useLayoutEffect
dependencies (#1495, thanks @JoviDeCroock) - ➕ Add warnings for
useMemo/useCallback
when dependencies haven't been specified (#1499, thanks @JoviDeCroock) - ➕ Add more
createElement
warnings in debug (#1494, thanks @marvinhagemeister) - ➕ Add warnings for
render()
(#1487, thanks @JoviDeCroock) - ➕ Add warning for invalid event handlers (#1409, thanks @JoviDeCroock)
- ➕ Add teardown to test-utils (#1458, thanks @JoviDeCroock)
- ➕ Add people demo from #1388 (#1453, thanks @andrewiggins @phaux)
- ➕ Add back
unstable_batchedUpdates
and replacemobx-preact
withmobx-react
in demo app (#1477, thanks @marvinhagemeister) - ➕ Add support for CSS Grid (#1407, thanks @JoviDeCroock)
- Switch from
*.mjs
->*.module.js
(#1425, thanks @marvinhagemeister) - 💾 Save 3 bytes (#1466, thanks @38elements)
- ➕ Add
teardown
totest-utils
(#1458, thanks @JoviDeCroock)
🐛 Bug Fixes
event.persist
should be a function, not an object (#1498, thanks @JoviDeCroock)- 🛠 Fix Portal crashing devtools (#1491, thanks @marvinhagemeister)
- 🛠 Fix stale DOM caused by empty Fragments (#1489, thanks @marvinhagemeister)
- ➕ Add test for fragment ordering (#1478, thanks @JoviDeCroock)
- 🛠 Fix DOM removed before
componentWillUnmount
(#1471, thanks @marvinhagemeister) - Don't call
setState
callback or enqueue a render in constructor (#1454, thanks @JoviDeCroock) - Jump to the next childDom if its
_dom
isnull
(#1452, thanks @Almo7aya) - Apply compat normalisation for every
vnode
(#1450, thanks @JoviDeCroock) - 🛠 Fix changes in getDerivedStateFromProps is not reflected to
_nextState
(#1446, thanks @mochiya98) - 🛠 Fix missing mangle config for
_prevState
(#1442, thanks @mochiya98) - 🍱 Always diff checked/value properties against the DOM. Fixes #1324. (#1438, thanks @utkarshkukreti) 🎉
- ➕ Add missing
test-utils
export inpreact/compat
(#1436, thanks @JoviDeCroock) - Replace
Object.assign
with custom assign function (#1433, thanks @marvinhagemeister) - Don't iterate over old CSS string (#1429, thanks @marvinhagemeister)
- 🛠 Fix safari failing on calc with CSS Custom Properties in SauceLabs (#1428, thanks @marvinhagemeister)
- Don't append
px
suffix for CSS Custom Properties (#1426, thanks @marvinhagemeister) - ⚡️ Updated links to the funcy.js source. (#1420, thanks @michael-klein)
- 🛠 Fix
componentDidUpdate
arguments (#1455, thanks @38elements) - 🛠 Fix
tagName
prop trying to change element type (#1419, thanks @JoviDeCroock) - 🛠 Fix missing className normalization on hydrate (#1421, thanks @marvinhagemeister)
- 🛠 Fix inconsistencies in
act
(#1437, thanks @JoviDeCroock) - Always diff checked/value properties against the DOM. (#1438, thanks @utkarshkukreti)
- Render bailout on equal state transition (#1449, thanks @JoviDeCroock)
- 👌 support svg attributes (#1451, thanks @JoviDeCroock)
- ⚡️ Move context update logic to diffing (#1468, thanks @JoviDeCroock)
- 🛠 Fix remove button adding todos in demo app (#1488, thanks @marvinhagemeister)
Typings
- ⚡️ Update option types (#1493, thanks @JoviDeCroock)
- ⚡️ Update internal compat types (#1483, #1456, thanks @38elements)
- ⚡️ Update internal context types (#1432, thanks @38elements)
- ⚡️ Update Component in internal.d.ts (#1443, thanks @38elements)
- 🛠 Fix
vnode
type definition (#1447, thanks @38elements) - ✂ Remove unnecessary settings in tsconfig.json (#1457, thanks @38elements)
- Warn on double encoding of JSX literals and other invalid nodes passed to
-
v10.0.0-alpha.2 Changes
March 14, 2019🚀 The weekend is coming and we thought it be a good time to make another alpha release for everyone to play with 🎉
🍱 This was a wonderful week for us. More and more bug reports contain links to a reproducible test case. You all are simply amazing! We wouldn't be able to fix this many bugs without all your help 👍 Even our contributions had an alltime high with excellent PRs from the community!
📦 Despite fixing many bugs we landed a new package to help you test hooks in Preact 🎉
✅ Introducing
preact/test-utils
⏱ With hooks having their own scheduling logic, we didn't have a good testing story up until now! First-time contributor @JoviDeCroock went right into it and quickly had a prototype running. With the blink of an eye he had a PR that was ready to be merged. These testing utilities are inspired by the excellent
react-dom/test-utils
tools and share a similaract()
function 👍🔀 For testing hooks effectively we need to flush pending effects synchronously. The brand new
act()
function allows you to do just that:import { act } from "preact/test-utils";let spy = sinon.spy();function StateContainer() { useEffect(spy); return \<div /\>; }// Wrap the render() with `act` to flush hooks automaticallyact(() =\> render(\<StateContainer /\>, document.body));// Do your assertions 🎉expect(spy).to.be.calledOnce;
⚡️ If you're working with
class
-based components you can use the newsetupRerender
function to flush pending state updates in your tests:import { setupRerender, Component } from "preact/test-utils";// Setup rerender logic firstconst rerender = setupRerender();let updateState;class App extends Component { constructor() { super(); this.state = { count: 0 }; updateState = () =\> this.setState(prev =\> ({ count: ++prev.count })); } render() { return \<div\>count: {this.state.count]}\</div\>; } }// Render your componentrender(\<App /\>, dom);expect(dom.textContent).to.equal("count: 0");// Trigger a state updateupdateState();// Flush all state updatesrerender();expect(dom.textContent).to.equal("count: 1");
🍱 It's his first contribution to Preact and we couldn't be more ecstatic about his work. Give him a round of applause 👍 It's also good to know for us that our code remains very accessible for new contributors.
🐛 Bug-Fixes
- 🛠 Fix devtools not loading (#1360, thanks @calebeby)
- Inline vnode children (#1317, thanks @developit)
- ✂ Remove double Promise on initialization (#1370, thanks @bmeurer and @marvinhagemeister)
- 🛠 Fix camelCase
style
properties not working (#1375, thanks @mochiya98) - 🛠 Fix
Portal
rendering undefined tags into the DOM (#1367, thanks @marvinhagemeister) - 🛠 Fix
this.props
not set forPureComponent
components (#1384, thanks @marvinhagemeister) - 👉 Use
console.error
for caught errors in the devtools adapter (#1385, thanks @yuqianma) - 🛠 Fix state not updated when
setState
is called incomponentWillReceiveProps
(#1369, thanks @mochiya98) - 🛠 Fix svg
foreignObject
not being treated as svg (#1391, thanks @marvinhagemeister) - 🛠 Fix
onBeforeInput
not attaching event handler (#1366, thanks @marvinhagemeister) - 🛠 Fix
React.isValidElement
check failing forvnodes
created with Preact (#1380, thanks @marvinhagemeister) - 🛠 Fix
<select>.value
not working (#1397, thanks @JoviDeCroock) - 🛠 Fix multiple selections for
<select>
only selecting last item (#1405, thanks @JoviDeCroock) - 🛠 Fix
force
flag blocking state update in secondrender()
(#1377, thanks @developit) - 🛠 Fix IE11 crashing because of missing
Element.prototype.remove
(#1395, thanks @marvinhagemeister) - 🛠 Fix
forwardRef
andmemo
ignoring refs when composed together (#1358, thanks @marvinhagemeister)
🐎 Performance
- 🚚 Move
_prevState
for devtools out of core (#1379, thanks @developit) - Reuse
oldChildrenLength
to save bytes (#1386, thanks @yuqianma) - 💅 Don't call
setProperty
for style strings (#1394, thanks @choumx)
Other
- 🛠 Fix unable to satisfy type parameters for
static
methods (#1365, thanks @marvinhagemeister) - ➕ Add back missing camelCase attributes (#1390, thanks @marvinhagemeister)
- ➕ Add missing autocorrect attribute types (#1393, thanks @garybernhardt)
- Ignore final new line for all
mangle.json
files (#1378, thanks @developit) - ➕ Add more tests for
componentWillReceiveProps
(#1387, thanks @developit)
-
v8.5.3 Changes
November 01, 2019- 🔄 Change Preact v8 "browser" field to "umd:main" (#1963, thanks @andrewiggins)
-
v8.5.2 Changes
August 18, 2019🚀 This release is a maintenance release and all users of the 8.x release line are encouraged to upgrade to it.
- 🛠 Fix devtools bridge not working with react devtools v4 (#1876)
-
v8.5.1 Changes
August 08, 2019🚀 This is a maintenance release and fixes a minor issue with the packaging of the
devtools
import. All users on the8.x
release line are encouraged to upgrade. -
v8.5.0 Changes
August 02, 2019🚀 This is a maintenance release for Preact's
8.x
versions. We'd like folks to try out Preact X, but if you're still using8
we have you covered.🚀 This release includes support for
createRef()
, and updated TypeScript definitions.