Changelog History
Page 3
-
v10.3.0 Changes
February 03, 2020_ tl;dr: This release contains a good number of bug fixes and we encourage all users to upgrade._
🚀 A little bit of time has passed since our last release and we're excited to ship another one, making Preact even more robust! The fixes nearly touch all packages and further improves compatibility with third-party libraries 🎉
🍱 If you glance at the contributor names, you'll notice a few new ones there. It's safe to say that we were amazed and super ecstatic by the amount of new first time contributors to Preact! 🙌
🔋 Features
- 👍 Include support for customised
built-in
elements (#2266, thanks @defx) - ⬆️ Upgrade devtools adapter to support Profiler and bring back
preact/devtools
import (#2246, thanks @marvinhagemeister)
🐛 Bug Fixes
- ⚡️ Suspended components should rerender through
shouldComponentUpdate
(#2125, thanks @andrewiggins) - ⬇️ Reduce reads of
dom.nextSibling
(#2294, thanks @andrewiggins) - Preserve state when using placeholders (#2295, thanks @andrewiggins)
- 🛠 Fix
Children.map
not flattening result (#2287, thanks @marvinhagemeister) - 🛠 Fix error when setting
size
to an invalid value (#2285, thanks @marvinhagemeister) - 🛠 Fix wrong SVG attribute for
clipPathUnits
(#2251, thanks @friebe) - 🛠 Fix both
class
andclassName
being enumerable (#2280, thanks @marvinhagemeister) - 🛠 Fix
className
patch not applied to props (#2279, thanks @marvinhagemeister) - Bailout when hook throws an error (#2193, thanks @JoviDeCroock)
- Avoid removing existing dom nodes on subsequent
replaceNode
calls (#2274, thanks @JoviDeCroock) - 🛠 Fix
shouldComponentUpdate
getting called onsetState
afterforceUpdate
(#2258, thanks @laino) - ✂ Remove
process.env.NODE_ENV
check frompreact/debug
which broke browsers (#2257, thanks @marvinhagemeister)
Types
- 👍 Allow
null
as an initial value foruseRef
(#2281, thanks @armujahid)
🚧 Maintenance
- Rename
_lastDomChildSibling
to_nextDom
(#2297, thanks @andrewiggins) - 👌 Improve code coverage (#2299, thanks @andrewiggins)
- ⚡️ Update
mangle.json
with Suspense prop rename (#2298, thanks @andrewiggins) - 🛠 Fix SVG polygon test failing on IE 11 (#2288, thanks @marvinhagemeister)
- Try out new node submodule exports (#2283, thanks @JoviDeCroock)
- ➕ Add section about reporting bugs (#2278, thanks @marvinhagemeister)
- 👌 Improve CONTRIBUTINIG + comments (#2277, thanks @marvinhagemeister)
- ➕ Add
size
action (#2270, thanks @developit) - Prevent
postinstall
from running on installation (#2271, thanks @JoviDeCroock) - ➕ Add test coverage for
createElement
(#2273, thanks @zubhav) - 🛠 Fix custom element tests failing in IE (#2272, thanks @marvinhagemeister)
- 🛠 Fix failing IE test (#2267, thanks @marvinhagemeister)
- ➕ Add info for first time contributors (#2265, thanks @marvinhagemeister)
- ➕ Add unit tests to check proper component unmounting (#2195, thanks @timon-witt)
- ➕ Add
npm ci
to speed up travis (#2255, thanks @JoviDeCroock) - ➕ Add
package-lock.json
(#2254, thanks @JoviDeCroock)
- 👍 Include support for customised
-
v10.2.1 Changes
January 08, 2020🚀 This release corrects an issue regarding hydration that was found in yesterdays
10.2.0
release 🎉🐛 Bug Fixes
- 🛠 Fix duplicate text node with
hydrate()
(#2238, thanks @JoviDeCroock)
- 🛠 Fix duplicate text node with
-
v10.2.0 Changes
January 07, 2020🚀 Happy belated New Years to everybody 🎉 We hope you enjoyed the holidays and had some time off to recharge 👍 Our very first release in 2020 brings two new features and the usual round of bug fixes 💯
🆕 New
useErrorBoundary
hook👀 There is a new hook called
useErrorBoundary
which allows you to catch errors that are thrown by any child components. It's essentially the hook version ofcomponentDidCatch
.// 1. parameter is null or the error that was caught// 2. paremeter can be called to reset the stateconst [err, reset] = useErrorBoundary();// Optional: You can pass a callback function that will// be executed when an error occurs:const [err] = useErrorBoundary(() =\> callMeMaybe());
Usage example:
// Example component that will throw an error on renderconst SomeComponent = () =\> { throw new Error("fail"); };const App = props =\> { const [err] = useErrorBoundary(); if (err) { return \<p\>Something went wrong...\</p\>; } else { return \<SomeComponent /\>; } };
0️⃣ Lazy works with non-default export
0️⃣ This PR was one of the smallest ones, but something that makes working with different kind of lazy loaded modules a lot easier. Previously
lazy
would always use thedefault
export of the imported module. With this change it's now possible to use it with anyexport
.// Look ma, no default exportconst LazyFoo = lazy(() =\> import("./Foo").MyComponent);
🍱 On top of that we have the usual round of bug fixes. We'd like to thank everyone who reported them and helped us make Preact even better. Thank you so much!! 👍
🔋 Features
- ➕ Add
useErrorBoundary
hook (#2205, thanks @JoviDeCroock) - 👍 Allow
lazy()
usage with non-default imports (#2212, thanks @developit)
🐛 Bug Fixes
- 🛠 Fix incorrect
ref
value on siblingvnodes
(#2217, thanks @JoviDeCroock) - 🛠 Fix stale closure in error boundary (#2225, thanks @JoviDeCroock)
- 🛠 Fix
Text
nodes being re-rendered unnecessarily (#2215, thanks @developit) - Shorten and correct
renderToString
dependency error (#2207, thanks @developit) - 👌 Support combination of
getDerivedStateFromError
andcomponentDidCatch
(#2200, thanks @JoviDeCroock) - 🛠 Fix compat hydration (#2206, thanks @JoviDeCroock)
Typings
- ➕ Add
onReset/onFormData
to Form Event types (#2209, thanks @thesmartwon)
🚧 Maintenance
- ⚡️ More README updates (#2235, thanks @developit)
- Modernize our README (#2232, thanks @JoviDeCroock)
- 📇 Update package metadata (#2230, thanks @developit)
- ➕ Add more test cases for
Suspense
(#2229, thanks @sventschui) - 🛠 Fix renderer tests by using
sinon
global (#2220, thanks @JoviDeCroock) - ⚡️ Update JSDoc comments (#2187, thanks @soulhat)
- ➕ Add
-
v10.1.1 Changes
December 16, 2019_ tl;dr: A tiny maintenance release, which helps with debugging Preact apps._
🚀 This release is a lot smaller compared to our usual ones, but we deemed one feature important enough to have in users hands that we made this release. And that's component stacks which we hope will reduce the issue count in our tracker slightly 🎉
On top of that we want to congratulate @jamesb3ll for his first-time contribution to Preact 🥇 He found an issue and filled it with every detail one can imagine (codesandbox is awesome!). But instead of stopping there, he tinkered a bit and found a genius fix for it! Thank you for your PR 👍 🍀
Component Stacks
⚠ Whenever you include
preact/debug
you get a lot of hints and warnings about how you can make your application better. But sometimes it was hard to tell where the error originated from. To resolve that we automatically append a component stack trace telling you directly which component threw the error.class Foo extends Component { constructor(props) { super(props); // Doesn't do anything, `this.state = { foo: true }`// should be used instead.this.setState({ foo: true }); } render() { return \<div\>foo\</div\>; } }function Bar() { return \<Foo /\>; }function Baz() { return \<Bar /\>; }
⚠ The above code will print the following warning to the browser's console:
🍱 With the stack appended at the bottom it's much easier to track down the source 💯 To get those beautiful file and line mappings, make sure that you have @babel/plugin-transform-react-jsx-source enabled in your babel config 👍
🔋 Features
- ➕ Add component stack in debug warnings (#2179, thanks @marvinhagemeister)
🐛 Bug Fixes
- 🛠 Fix
componentWillReceiveProps
not called on child component when parent is queued in the same commit (#2186, thanks @jamesb3ll)
🚧 Maintenance
- ↪ Workaround for
sinon
esm bundle (#2188, thanks @marvinhagemeister)
-
v10.1.0 Changes
December 09, 2019_ tl;dr: This release adds support for the highly anticipated preact-devtools extension. It's in an early preview state, but it has proven to be very useful already for inspecting a component tree in our internal testing. Apart from that there is a new
SuspenseList
component to control loading in lists and the usual round of bug fixes._🚀 Christmas comes early in the form of another feature packed Preact release 🎉 We're particular proud of this one as it represents the results of a lot of work behind the scenes. Especially when it comes to the devtools.
🍱 Developers, Developers, Developers! 🔧
For the longest time we've been able to reuse the react devtools extension that was (as the name implies) written specifically for React. We did this by hooking ourselves into the init procedure and shimming in a conversion layer that translated our inner workings to something React would use under the hood. Over the past year we've kept up with all the internal changes of React's private structures, but it took us more and more time to make sure that the integration wasn't breaking or running into weird edge cases.
💻 Faced with a choice we decided to pursue the development of our own extension specifically written for Preact. This way we are not affected by any breaking changes on React's side and have the possibility to extend the devtools with custom UI, like for the Composition-API PR #1923 .
🚀 That said the extension is not what we would call final yet. It's more of an early preview, akin to an
alpha
release. Despite bugs you may encounter, we found it useful enough in our testing that we didn't want to hold back any longer.Download it here: https://preactjs.github.io/preact-devtools/
🍱 SuspenseList 🔢
💻
SuspenseList
is a new component that can control the order in which any child suspensions are revealed. Take a list of images for example. Due to the browser firing the requests to download them in parallel, the images may appear in any order. This can be a bit jarring, when some sort ofappear
animation is involved. WithSuspenseList
we can force all images to appear at the same time, inorder or in reverse.In the following example
A
will appear first, followed byB
even ifC
was loaded beforeB
. And finallyC
will appear.// `revealOrder` can be one of 'forwards', 'backwards' or 'together'\<SuspenseList revealOrder="forwards"\> \<Suspense fallback={\<span\>Loading...\</span\>}\> \<A /\> \</Suspense\> \<Suspense fallback={\<span\>Loading...\</span\>}\> \<B /\> \</Suspense\> \<Suspense fallback={\<span\>Loading...\</span\>}\> \<C /\> \</Suspense\> \</SuspenseList\>
🔋 Features
- ➕ Add support for preact-devtools (#2148, thanks @marvinhagemeister)
SuspenseList
optimisations (#2121, thanks @jviide)- ➕ Add
SuspenseList
component (#2063, thanks @prateekbh)
🐛 Bug Fixes
- 👍
Suspense
should support unmounting suspender (#2134, thanks @sventschui) - ➕ Add correct
this
type for event handlers (#2166, thanks @marvinhagemeister) - Prevent crash in IE when setting
type
attribute (#2147, thanks @Rafi993) - Always use lower cased
touch
events incompat
(#2120, thanks @sventschui) - 🛠 Fix wrong DOM order on suspend inside
Fragment
(#2107, thanks @jviide)
Typings
- ➕ Add
onToggle
event to TypeScript defs. (#2151, thanks @xorgy) - Re-export
FunctionComponent
frompreact/compat
(#2087, thanks @jokester) - 🛠 Fix internal Suspense-related typings (#2117, thanks @jviide)
- Specify valid
dir
property values (#2108, thanks @antonk52)
🍱 Golf ⛳️🏌️♀️
- ⚡️ Optimize
createElement
(#2135, thanks @developit) - Rename
useMemo
_callback
to_factory
(+0 B) (#2131, thanks @andrewiggins) - ✂ Remove redundant
if
clause in suspense_catchError
(#2119, thanks @sventschui) - Consolidate
VNode
compat options (-62 B) (#2116, thanks @andrewiggins)
🚧 Maintenance
- 👷 Disable benchmarks on CI (#2167, thanks @marvinhagemeister)
- 🛠 Fix minor spelling and grammar issue (#2165, thanks @ivanjonas)
- ⚡️ Update perf tests for Preact X and enable on
master
(#2158, thanks @andrewiggins) - ✅ Rewrite touch event tests to not use internals (#2157, thanks @andrewiggins)
- 👌 Improve test DOM helpers (#2152, thanks @andrewiggins)
- ✅ Rewrite some tests to no longer rely on internals (#2132, thanks @andrewiggins)
- 🛠 Fix cross browser tests assertions (#2127, thanks @andrewiggins)
- ✅ Modularize
compat
src and tests (#2124, thanks @andrewiggins) - ➕ Add test to cover hooks debug helper (#2115, thanks @andrewiggins)
- ➕ Add test for lifecycles and state of a delayed suspending compo… (#2114, thanks @andrewiggins)
-
v10.0.5 Changes
November 10, 2019_ tl;dr: This release is a bug fix only release and all users are encouraged to update._
🍱 This week saw many cool improvements surrounding our TypeScript definitions. Thanks to an amazing contribution from @lukeshiru the event target is now correctly inferred for all native elements. This alone should remove many manually casted event arguments in your code 🎉
🍱 Together @JoviDeCroock and @cristianbote set their minds on fixing a few newly reported issues surrounding
refs
and the like. Personally, I'm pretty impressed how quickly they could identify and resolve the issues. Much respect to you two 👍As the year is coming to an end @andrewiggins did some house-cleaning and found various places where we could save even more bytes! I don't know how he does it and it's just amazing to witness so much pure talent!
🚧 Beside that, the changes mainly revolve around maintenance tasks. We've switched to
prettier
for automatic code formatting, lowering the barrier for new contributors even more. The formatting is automatically applied on each commit via a git-hook, and everything will be taken care of for you 💯🍱 We also saw two exciting contributions from Googlers: @jridgewell found a very hard to spot unnecessary case in a regex we use to append
px
to certain CSS values and @jakearchibald found an html attribute we missed in our typings 🎉🚀 Like in our past release we'd like to take a moment to thank everybody who contributed, not just code but also made the time to write bug reports. Thank you so much 👍
🐛 Bug Fixes
- Cleanup changing
refs
correctly (#2055, thanks @JoviDeCroock) - Ensure
renderCallbacks
are called whensCU
bails out (#2081, thanks @JoviDeCroock) - 🖐 Handle the stale
ref
forforwardRef
(#2075) (#2076, thanks @cristianbote)
🍱 Golf 🏌️♀️
- ⏱ Simplify
hook
scheduling logic (-17 B) (#2085, thanks @andrewiggins) - 👌 Improve tree-shakeability (-13 B) (#2079, thanks @andrewiggins)
- Simplify ternary expressions (-7 B) (#2049, thanks @andrewiggins)
- Remove CSS custom property check from
IS_NON_DIMENSIONAL
(#2046, thanks @jridgewell)
TypeScript
- ➕ Add types for
currentTarget
on event handlers forIntrinsicElements
(#2084, thanks @lukeshiru) - 👌 Improve
ref
typings forIntrinsicElements
(#2070, thanks @lukeshiru) - ➕ Add
as
html attribute to TypeScript defs (#2068, thanks @jakearchibald)
🚧 Maintenance
- ➕ Add
funding
field to package.json (#2096, thanks @developit) - ⬆️ Upgrade tests to use Babel 7 (#2094, thanks @andrewiggins)
- ✅ Rewrite
createContext
tests to no longer import internal data (#2090, thanks @andrewiggins) - ✂ Remove
preact-charts
fromREADME
(#2092, thanks @pmkroeker) - ⚡️ Update
README
section aboutpreact/devtools
(#2091, thanks @peterswallow) - ✅ In tests, import code under test by name instead of relative path (#2086, thanks @andrewiggins)
- Replace
__p
to__
inmangle.json
(#2044, thanks @38elements) - 👉 Make all
.json
files use 2-space (#2078, thanks @developit) - ➕ Adding Intergram to the demos list (#2064, thanks @idoco)
- 👌 Improve formatting (#2071, thanks @andrewiggins)
- 👌 Improve formatting (#2066, thanks @andrewiggins)
- ➕ Add automatic formatting via
prettier
(#2065, thanks @marvinhagemeister)
- Cleanup changing
-
v10.0.4 Changes
October 29, 2019🚀 This release fixes a build issue that caused errors when using effect hooks.
- ➕ Add missing
_renderCallbacks
mangle configuration (#2060, thanks @robertknight)
- ➕ Add missing
-
v10.0.3 Changes
October 29, 2019🚀 This release corrects an issue where a debug warning was printed incorrectly to the console, that (rightfully) confused users. So we wanted to fix that as quick as possible 👍
🐛 Bug Fixes
- 🛠 Fix
setState
warning always being printed (#2057, thanks @marvinhagemeister)
🚧 Maintenance
- Queue
layoutEffects
in component render callbacks array (+0 B) (#2050, thanks @andrewiggins) - ✅ Separate
debug
tests into multiple files and fix some bugs in debug (#2047, thanks @andrewiggins)
- 🛠 Fix
-
v10.0.2 Changes
October 28, 2019_ tl;dr: This is release contains mostly bug fixes and some size reductions. We encourage everyone to upgrade._
🚀 Just a week has passed since the last release and there are already an exciting number of new commits in master. Hackoktoberfest has had really positive effects on us and we're excited to see some new contributors in this release 💯
👀 As you can see from the changelog: @andrewiggins is currently on a byte removing spree, so I thought it'd be appropriate to list them in their own category 🎉 A few others joined him and marie kondo'ed everything that didn't spark joy in us!
🍱 Besides some great savings, there are new debug warnings for components and fixes for our Suspense implementation 🎉
🔋 Features
- ➕ Add debug warnings when calling
setState
orforceUpdate
on an unmounted component (#2037, thanks @andrewiggins)
🐛 Bug Fixes
- 👌 Support re-suspending with
<Suspense>
(#2025, thanks @andrewiggins) - ➕ Add unpkg aliases (#2032, thanks @developit)
- 🛠 Fix
ref
not always called inuseImperativeHandle
(#2021, thanks @JoviDeCroock)
Golf (size reductions)
- Inline
coerceToVNode
inside oftoChildArray
(-21 B) (#2040, thanks @andrewiggins) - ✂ Remove unused mount check in context Provider (-6 B) (#2039, thanks @andrewiggins)
- Golfed render (#2045, thanks @MohammedSheikhIbrahim)
- ✂ Remove useless return from eventProxy (#2026, thanks @jridgewell)
- Rewrite
useImperativeHandle
to useuseLayoutEffect
(-35 B) (#2003, thanks @andrewiggins) - Re-purpose
renderCallbacks
as a general per-component commit queue (#2011, thanks @andrewiggins)
Types
- ➕ Add
nonce
to JSXHTMLAttributes
types for better Content Security Policy support. (#2035, thanks @calvinf) - ✂ Remove internal import from compat types (#2018, thanks @andrewiggins)
- 🛠 Fix internal
vnode
typings (#2015, thanks @pmkroeker)
🚧 Maintenance
- ✂ Remove end of line in
compat/mangle.json
(#2053, thanks @38elements) - Add
_afterPaintQueued
and_fallback
tomangle.json
(#2043, thanks @38elements) - ✂ Remove OpenCollective postinstall Banner (#2033, thanks @developit)
- ⚡️ Update
preact/compat
in readme (#2029, thanks @developit) - 🛠 Fixed some typos and grammatical mistakes. (#2028, thanks @MohammedSheikhIbrahim)
- 👮 Add
_force
and_lastDomChild
tomangle.json
(#2023, thanks @developit) - ➕ Add
_suspensions
to mangle (#2019, thanks @JoviDeCroock) - ➕ Add npm script to run compat TS tests (#2017, thanks @andrewiggins)
- ➕ Add debug warnings when calling
-
v10.0.1 Changes
October 17, 2019_ tl;dr: This is a standard bug-fix release with no new features. We encourage everyone to upgrade_
🚀 Wow, we've been overwhelmed with the reactions to our final Preact X release! We saw a huge uptick in npm downloads to 200.000 per week 🎉 Another exciting announcement is that Google AMP is officially using Preact under the hood. We've receivied many more thank you notes (and even stroopwafels!) from companies using Preact. Those range from small companies to big enterprise ones, where Preact is used in a wide span of different environments.
🍱 We preactively allocated the weeks after the big launch for a period of bug-fixes only in case something slipped through. It was admittedly a more conservative decision after our long alpha and beta period, but we wanted to make sure that you all would have a butter smooth experience no matter what 🌠 It's safe to say that it went really well and we've only received a couple bug reports so far 🎉
🚀 In the short amount of time that has passed since the release, we managed to squash a good portion of those! Thank you so much to everyone for reporting bugs and helping us track them down! You rock 👍 💯
🐛 Bug Fixes
- Resolve attributes of reused nodes that weren't present in
virtual-dom
(#1987, thanks @JoviDeCroock) - 🛠 Fix stale
context
values (forcreateContext
-API) (#2005, thanks @JoviDeCroock) - Properly flush nested
setState
callbacks (-6 B) (#2010, thanks @andrewiggins) - Import and re-export hooks explicitly to allow for webpack tree shaking (#2006, thanks @davidbailey00)
- Removing reference to
preact-context
library (#2001, thanks @jackbravo) - 🛠 Fix
forceUpdate
enqueued child update being skipped (#1988, thanks @marvinhagemeister) - Append
Portal
node to container instead of prepend (#1971, thanks @toraora) - Always pull
_force
flag from component (#1984, thanks @marvinhagemeister) - 🛠 Fix typos in JSDoc (#1973, thanks @polemius)
- 🛠 Fix
replaceNode
not always taking effect (#1970, thanks @JoviDeCroock)
Types
- ✂ Remove
null
fromVNode.type
TS definition and add some TS tests (#1994, thanks @andrewiggins) - ➕ Add
_force
to internal.d.ts (#1990, thanks @38elements) - 👌 Improve
VNode
typings (#1979, thanks @andrewiggins)
🚧 Maintenance
- ⚡️ Golf
shouldComponentUpdate
(#1980, thanks @JoviDeCroock) - ➕ Add Songsterr to Real-World Apps section (#1972, thanks @followdarko)
- Resolve attributes of reused nodes that weren't present in