Skip to content
Merged
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
9 changes: 9 additions & 0 deletions packages/devtools-kit/src/shared/transfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ function isArray(_data: unknown, proto: string): _data is unknown[] {
return proto === '[object Array]'
}

// See https://github1s.com/vuejs/core/blob/HEAD/packages/reactivity/src/dep.ts#L32-L33
function isVueReactiveLinkNode(node) {
const constructorName = node.constructor.name
return (constructorName === 'Dep' && 'activeLink' in node) || (constructorName === 'Link' && 'dep' in node)
}

/**
* This function is used to serialize object with handling circular references.
*
Expand Down Expand Up @@ -41,6 +47,9 @@ function encode(data: unknown, replacer: Replacer | null, list: unknown[], seen:
const index = list.length
const proto = Object.prototype.toString.call(data)
if (isObject(data, proto)) {
if (isVueReactiveLinkNode(data)) {
return index
}
stored = {}
seen.set(data, index)
list.push(stored)
Expand Down