Skip to content

Commit 87cda11

Browse files
committed
fix(custom-elements): stop overriding the provides object of the internal instance
The internal instance of a custom element already inherits the app context’s provides object via the prototype chain, so there’s no need to override it or add extra logic to the `provide` function.
1 parent 6694878 commit 87cda11

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

packages/runtime-core/src/apiInject.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,8 @@ export function provide<T, K = InjectionKey<T> | string | number>(
2323
// own provides object using parent provides object as prototype.
2424
// this way in `inject` we can simply look up injections from direct
2525
// parent and let the prototype chain do the work.
26-
// #13212, custom elements inherit the provides object from appContext
27-
const parentProvides = currentInstance.ce
28-
? currentInstance.appContext.provides
29-
: currentInstance.parent && currentInstance.parent.provides
26+
const parentProvides =
27+
currentInstance.parent && currentInstance.parent.provides
3028
if (parentProvides === provides) {
3129
provides = currentInstance.provides = Object.create(parentProvides)
3230
}

packages/runtime-dom/src/apiCustomElement.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,6 @@ export class VueElement
316316
private _setParent(parent = this._parent) {
317317
if (parent) {
318318
this._instance!.parent = parent._instance
319-
this._instance!.provides = this._instance!.appContext.provides
320319
this._inheritParentContext(parent)
321320
}
322321
}

0 commit comments

Comments
 (0)