From 9d16201c09bc2ec522a2a9ced6296e1f96d2635b Mon Sep 17 00:00:00 2001 From: DoomGuy <307901355+abhhjhh28-svg@users.noreply.github.com> Date: Fri, 6 Nov 2026 08:37:59 +0300 Subject: [PATCH] docs: explain reactive state cloning caveats --- src/api/reactivity-advanced.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/api/reactivity-advanced.md b/src/api/reactivity-advanced.md index a8c5f6350f..d824bbae33 100644 --- a/src/api/reactivity-advanced.md +++ b/src/api/reactivity-advanced.md @@ -241,6 +241,8 @@ Returns the raw, original object of a Vue-created proxy. console.log(toRaw(reactiveFoo) === foo) // true ``` +`toRaw()` returns the original object, not a copy, and does not recursively unwrap nested refs or reactive objects. When cloning reactive state with APIs such as `structuredClone()`, pass plain data rather than a reactive proxy. For example, `structuredClone(toRaw(state))` works when the raw object contains only values supported by `structuredClone()`. If it contains nested refs or reactive objects, convert those nested values to plain data first. + ## markRaw() {#markraw} Marks an object so that it will never be converted to a proxy. Returns the object itself.