Skip to content

8.0.0

Pre-release
Pre-release
Compare
Choose a tag to compare
@developit developit released this 06 Apr 03:44
· 4695 commits to main since this release

8.0.0 (beta)

It's here! 🌈

This release represents a huge step forward for Preact:

  • Significantly increased performance - in some cases by 30%.
  • Better compatibility - key for PFC's, class integrations, capturing events.
  • Fewer edge cases - goodbye to unnecessary mounts and DOM hierarchy errors.
  • Even smaller - Preact had been 3.9kb for a while - now it's 3.3kb (and headed for 2.9kb!)

💁 If you're looking to upgrade, be sure to read the quick guide.

Breaking Changes

  • Pure Functional Components now have backing instances. This means key now works perfectly on PFC's. It also means you could use state and lifecycle methods in Functional Components... (#163, #517, #536, #586, #474)
  • linkState() has been removed from Preact itself. It is being published as a standalone linkstate module shortly.
  • class and className no longer serialize Object values to Strings. Instead, use classnames (#401)
  • preact/aliases is no longer necessary. createElement() is now an alias of h() right out of the box!
  • DOM element recycling has been removed. It was a source of issues for many, and is no longer necessary for great performance thanks to diff optimizations that reduce the number of cases where elements are removed and re-added. (#544, #351, #461, #459, #503, #535, #562)
  • Undefined components references now throw rather than rendering <undefined> (#574)
  • No more Symbol. Instead of try to use Symbol.for('preactattr'), __preactattr_ is always used.
  • Render debouncing now uses setTimeout(0) instead of Promises. It's smaller, doesn't swallow rendering errors in Safari, and was already the fallback (#357)
  • The non-standard componentDidUnmount() lifecycle method is removed. Use componentWillUnmount().
  • onXxxxCapture is now supported for registering capturing event handlers.
  • Events like focus and blur are no longer automatically capturing by default.

Bugs Fixed

  • Hierarchy errors are a thing of the past (thanks to recycler and PFC rewrites) (#380, #391)
  • Fixed edge case that could cause children to be rendered out of order (#581, #603)
  • Unmount lifecycle is always fired when replacing a Component with an empty element (#538, #534)
  • ref functions attached to DOM nodes are no longer invoked for updates, only for mount/unmount.

Other Notable Changes

  • "holes" in JSX children are now preserved and used intelligently by the diff (#580, #540)
  • Re-rendering a compositional child with a different key prop now triggers a remount (#338)
  • JSX children passed to a Component are preserved rather than normalized (#551)
  • Preact no longer relies on the Text or Array constructors for type checks, instead relying on duck typing (#595, #530)
  • Ignore whitespace-only Text nodes during SSR hydration. SSR boot is now significantly faster than cold boot.

Here's the list of changes itemized by commit:
master...8