Skip to content

Commit

Permalink
perf: resolve options raw once
Browse files Browse the repository at this point in the history
  • Loading branch information
johannschopplich committed Feb 28, 2024
1 parent ee10dbf commit 0e4bb03
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/runtime/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ import type { GoogleTagOptions } from './types'
import { toRaw } from '#imports'

export function resolveTags(options: Required<ModuleOptions>) {
const _options = toRaw(options)

// Normalize tags
const tags: GoogleTagOptions[] = toRaw(options).tags.filter(Boolean)
const tags: GoogleTagOptions[] = _options.tags.filter(Boolean)
.map(i => typeof i === 'string' ? { id: i } : i)

if (options.id) {
const { id, config, initCommands } = toRaw(options)
const { id, config, initCommands } = _options
tags.unshift({ id, config, initCommands })
}

Expand Down

0 comments on commit 0e4bb03

Please sign in to comment.