GitHub

Original file line numberDiff line numberDiff line change

@@ -62,7 +62,13 @@ export default defineNuxtPlugin(() => {

6262

style.setAttribute('data-nuxt-ui-colors', '')

6363

document.head.appendChild(style)

6464
65-

injectHead().hooks.hookOnce('dom:rendered', removeTemporaryColorsStyle)

65+

// `hookOnce` is only available on unhead v2's `Hookable`. In v3 `hooks` is a `HookableCore`

66+

// that exposes `hook` only, so self-unhook to keep the once semantics across both versions.

67+

const head = injectHead()

68+

const unhook = head.hooks?.hook('dom:rendered', () => {

69+

removeTemporaryColorsStyle()

70+

unhook?.()

71+

})

6672

}

6773
6874

useHead(headData)

Read the original on github.com ↗