Skip to content

Commit 278aad8

Browse files
committed
fix: change _teleportTargets from an array to a Set to avoid duplicate collections
1 parent c7f80ee commit 278aad8

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

packages/runtime-core/src/component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1273,5 +1273,5 @@ export interface ComponentCustomElementInterface {
12731273
/**
12741274
* @internal attached by the nested Teleport when shadowRoot is false.
12751275
*/
1276-
_teleportTargets?: RendererElement[]
1276+
_teleportTargets?: Set<RendererElement>
12771277
}

packages/runtime-core/src/components/Teleport.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ export const TeleportImpl = {
147147
if (parentComponent && parentComponent.isCE) {
148148
;(
149149
parentComponent.ce!._teleportTargets ||
150-
(parentComponent.ce!._teleportTargets = [])
151-
).push(target)
150+
(parentComponent.ce!._teleportTargets = new Set())
151+
).add(target)
152152
}
153153

154154
if (!disabled) {

packages/runtime-dom/src/apiCustomElement.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ export class VueElement
224224
/**
225225
* @internal
226226
*/
227-
_teleportTargets?: HTMLElement[]
227+
_teleportTargets?: Set<HTMLElement>
228228

229229
private _connected = false
230230
private _resolved = false

0 commit comments

Comments
 (0)