Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: toString utils should unref the Ref<T> #12888

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/shared/util.ts
@@ -1,3 +1,5 @@
import { isRef, unref } from 'v3'

export const emptyObject: Record<string, any> = Object.freeze({})

export const isArray = Array.isArray
Expand Down Expand Up @@ -90,7 +92,7 @@ export function toString(val: any): string {
return val == null
? ''
: Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
? JSON.stringify(val, null, 2)
? JSON.stringify(isRef(val) ? unref(val) : val, null, 2)
: String(val)
}

Expand Down