Skip to content

Commit 54d8aca

Browse files
committed
fix
1 parent f555af9 commit 54d8aca

File tree

2 files changed

+12
-17
lines changed

2 files changed

+12
-17
lines changed

packages/runtime-vapor/src/component.ts

+11-16
Original file line numberDiff line numberDiff line change
@@ -439,22 +439,17 @@ export function formatComponentName(
439439
}
440440
}
441441

442-
// TODO registry
443-
// if (!name && instance && instance.parent) {
444-
// // try to infer the name based on reverse resolution
445-
// const inferFromRegistry = (registry: Record<string, any> | undefined) => {
446-
// for (const key in registry) {
447-
// if (registry[key] === Component) {
448-
// return key
449-
// }
450-
// }
451-
// }
452-
// name =
453-
// inferFromRegistry(
454-
// instance.components ||
455-
// (instance.parent.type as ComponentOptions).components,
456-
// ) || inferFromRegistry(instance.appContext.components)
457-
// }
442+
if (!name && instance && instance.parent) {
443+
// try to infer the name based on reverse resolution
444+
const inferFromRegistry = (registry: Record<string, any> | undefined) => {
445+
for (const key in registry) {
446+
if (registry[key] === Component) {
447+
return key
448+
}
449+
}
450+
}
451+
name = inferFromRegistry(instance.appContext.components)
452+
}
458453

459454
return name ? classify(name) : isRoot ? `App` : `Anonymous`
460455
}

packages/runtime-vapor/src/helpers/resolveAssets.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { camelize, capitalize } from '@vue/shared'
22
import { type Directive, warn } from '..'
33
import { type Component, currentInstance } from '../component'
4-
import { getComponentName } from '../warning'
4+
import { getComponentName } from '../component'
55

66
export const COMPONENTS = 'components'
77
export const DIRECTIVES = 'directives'

0 commit comments

Comments
 (0)