Skip to content

Commit c2dde29

Browse files
fix(devtools-kit): remove special handling for Router object (#1092)
1 parent eed0958 commit c2dde29

4 files changed

Lines changed: 3 additions & 25 deletions

File tree

packages/devtools-kit/src/core/component/state/custom.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -140,22 +140,6 @@ export function getStoreDetails(store) {
140140
}
141141
}
142142

143-
export function getRouterDetails(router) {
144-
return {
145-
_custom: {
146-
type: 'router',
147-
displayText: 'VueRouter',
148-
value: {
149-
options: router.options,
150-
currentRoute: router.currentRoute,
151-
},
152-
fields: {
153-
abstract: true,
154-
},
155-
},
156-
}
157-
}
158-
159143
// @TODO: fix circular dependency
160144
export function getInstanceDetails(instance) {
161145
if (instance._)

packages/devtools-kit/src/core/component/state/replacer.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ensurePropertyExists } from '../utils'
22
import { INFINITY, MAX_ARRAY_SIZE, MAX_STRING_SIZE, NAN, NEGATIVE_INFINITY, UNDEFINED } from './constants'
3-
import { getBigIntDetails, getComponentDefinitionDetails, getDateDetails, getFunctionDetails, getHTMLElementDetails, getInstanceDetails, getMapDetails, getObjectDetails, getRouterDetails, getSetDetails, getStoreDetails } from './custom'
3+
import { getBigIntDetails, getComponentDefinitionDetails, getDateDetails, getFunctionDetails, getHTMLElementDetails, getInstanceDetails, getMapDetails, getObjectDetails, getSetDetails, getStoreDetails } from './custom'
44
import { isVueInstance } from './is'
55
import { sanitize } from './util'
66

@@ -73,9 +73,6 @@ export function stringifyReplacer(key: string | number, _value: any, depth?: num
7373
else if (ensurePropertyExists(val, 'state', true) && ensurePropertyExists(val, '_vm', true)) {
7474
return getStoreDetails(val)
7575
}
76-
else if (val.constructor && val.constructor.name === 'VueRouter') {
77-
return getRouterDetails(val)
78-
}
7976
else if (isVueInstance(val as Record<string, unknown>)) {
8077
const componentVal = getInstanceDetails(val)
8178
const parentInstanceDepth = seenInstance?.get(val)
@@ -98,9 +95,6 @@ export function stringifyReplacer(key: string | number, _value: any, depth?: num
9895
else if (val.constructor?.name === 'Store' && '_wrappedGetters' in val) {
9996
return '[object Store]'
10097
}
101-
else if (ensurePropertyExists(val, 'currentRoute', true)) {
102-
return '[object Router]'
103-
}
10498
const customDetails = getObjectDetails(val)
10599
if (customDetails != null)
106100
return customDetails
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export type customTypeEnums = 'function' | 'bigint' | 'map' | 'set' | 'store' | 'router' | 'component' | 'component-definition' | 'HTMLElement' | 'component-definition' | 'date'
1+
export type customTypeEnums = 'function' | 'bigint' | 'map' | 'set' | 'store' | 'component' | 'component-definition' | 'HTMLElement' | 'component-definition' | 'date'

packages/devtools-kit/src/types/component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export interface ComponentTreeNode {
2121
file?: string
2222
}
2323

24-
type ComponentBuiltinCustomStateTypes = 'function' | 'map' | 'set' | 'reference' | 'component' | 'component-definition' | 'router' | 'store'
24+
type ComponentBuiltinCustomStateTypes = 'function' | 'map' | 'set' | 'reference' | 'component' | 'component-definition' | 'store'
2525

2626
interface ComponentCustomState extends ComponentStateBase {
2727
value: CustomState

0 commit comments

Comments
 (0)