Skip to content

Commit a1d38fa

Browse files
committed
Revert "fix(scripts): lazily trigger beforeInit"
This reverts commit d1e1930.
1 parent 7cd59d2 commit a1d38fa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/unhead/src/composables/useScript.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export function useScript<T extends Record<symbol | string, any>>(_input: UseScr
2424
const id = input.key || hashCode(input.src || (typeof input.innerHTML === 'string' ? input.innerHTML : ''))
2525
if (head._scripts?.[id])
2626
return head._scripts[id]
27+
options.beforeInit?.()
2728
const syncStatus = (s: ScriptInstance<T>['status']) => {
2829
script.status = s
2930
head.hooks.callHook(`script:updated`, hookCtx)
@@ -83,7 +84,6 @@ export function useScript<T extends Record<symbol | string, any>>(_input: UseScr
8384
defaults.crossorigin = 'anonymous'
8485
defaults.referrerpolicy = 'no-referrer'
8586
}
86-
options.beforeInit?.()
8787
// status should get updated from script events
8888
script.entry = head.push({
8989
script: [{ ...defaults, ...input, key: `script.${id}` }],

0 commit comments

Comments
 (0)