From e50a7e43fb92870ef549f162dca4c40fbfb5f472 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Tue, 14 Jan 2025 23:18:06 +0800 Subject: [PATCH] chore: update --- packages/nuxt/src/core/nuxt.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/nuxt/src/core/nuxt.ts b/packages/nuxt/src/core/nuxt.ts index 064ff2325a..32615852ff 100644 --- a/packages/nuxt/src/core/nuxt.ts +++ b/packages/nuxt/src/core/nuxt.ts @@ -86,15 +86,22 @@ export function createNuxt (options: NuxtOptions): Nuxt { const proxied = onChange( options, - (keys, value, previousValue, applyData) => { - if (value === previousValue && !applyData) { + (keys, newValue, previousValue, applyData) => { + if (newValue === previousValue && !applyData) { return } + let value = applyData?.args ?? newValue + // Make a shallow copy of the value + if (Array.isArray(value)) { + value = [...value] + } else if (typeof value === 'object') { + value = { ...(value as any) } + } nuxt._debug!.moduleMutationRecords!.push({ module: currentModule, keys, target: 'nuxt.options', - value: applyData?.args ?? value, + value, timestamp: Date.now(), method: applyData?.name, })