Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/shared/__tests__/toDisplayString.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ describe('toDisplayString', () => {
np
})
).toBe(JSON.stringify({ n: 1, np: 2 }, null, 2))
// #5578
const nums = [ref('text')]
expect(toDisplayString(nums[0])).toBe('text')
})

test('objects with custom toString', () => {
Expand Down
6 changes: 5 additions & 1 deletion packages/shared/src/toDisplayString.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ import {
* For converting {{ interpolation }} values to displayed strings.
* @private
*/
export const toDisplayString = (val: unknown): string => {
export const toDisplayString = (val: any): string => {
//fix #5578
if (val && val.__v_isRef) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

val?.__v_isRef ?)

return toDisplayString(val.value)
}
return isString(val)
? val
: val == null
Expand Down