Highlights 🔥
Improved DOM Renderer (#185)
The slowest part of Unhead is figuring out what DOM elements and attributes are needed to be added, updated or removed.
This release introduces an improved DOM renderer with some key improvements:
- 30% Smaller: Now under 1kb (954 bytes)
- ~50% Faster: Taking a typical site from 30ms to 15ms to render tags on the initial mount and 11ms to 7ms on page changes.
Bundle Improvements
You should see a ~20% reduction in your client bundle without losing any functionality.
- Code was cleaned up and simplified
- Utils no longer exported
- Deprecated composables removed
Before
After
Hash Hydration Plugin (#183)
A flag was previously introduced that enabled experimental hash hydration experimentalHashHydration
. This reduces your initial mount time to 0ms for the dom renderer. This has now been moved to a plugin.
This is now an optional plugin and should perform better.
createHead({
- experimentalHashHydration: true,
+ plugins: [
+ HashHydrationPlugin()
+ ]
})
Other Changes
- Debounced promise is now attached to the Unhead instance instead of global
- New hook:
dom:rendered
get tags once they're rendered
⚠️ Breaking Changes
There were a number of more verbose composable which were deprecated in v1, they have now been removed. (#184).
If you're using any of the following, you should use the useHead
or other composable.
useTagTitle
useTagBase
useTagMeta
useTagMetaFlat
useTagLink
useTagScript
useTagStyle
useTagNoscript
useHtmlAttrs
useBodyAttrs
useTitleTemplate
useServerTagTitle
useServerTagBase
useServerTagMeta
useServerTagMetaFlat
useServerTagLink
useServerTagScript
useServerTagStyle
useServerTagNoscript
useServerHtmlAttrs
useServerBodyAttrs
useServerTitleTemplate