Skip to content

Commit

Permalink
fix: add legacy functions to unhead instance
Browse files Browse the repository at this point in the history
  • Loading branch information
harlan-zw committed Nov 13, 2022
1 parent 04e983b commit 80ccf3c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/createHead.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,14 @@ export function createHead<T extends MergeHead = {}>(initHeadObject?: Head<T>):
},
}

// we need to load a bunch of the pre v1 @vueuse/head functions on to the unhead instance as this is what is returned
// from the injection

// @ts-expect-error runtime hack to fix legacy implementations
unhead.addHeadObjs = legacyHead.addHeadObjs
// @ts-expect-error runtime hack to fix legacy implementations
unhead.updateDOM = legacyHead.updateDOM

unhead.hooks.hook('dom:beforeRender', (ctx) => {
for (const hook of legacyHead.hooks['before:dom']) {
if (hook() === false)
Expand Down

0 comments on commit 80ccf3c

Please sign in to comment.