Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7997072

Browse files
ChauChau
Chau
authored and
Chau
committed
refactor(core): remove unnecessary portal injectors handling
1 parent 099a365 commit 7997072

File tree

2 files changed

+2
-11
lines changed

2 files changed

+2
-11
lines changed

libs/core/src/lib/portal.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import * as THREE from 'three';
2121
import { Group } from 'three';
2222
import { getInstanceState, prepare } from './instance';
2323
import { extend } from './renderer/catalogue';
24-
import { NGT_DOM_PARENT_FLAG, NGT_INTERNAL_ADD_COMMENT_FLAG, NGT_PORTAL_CONTENT_FLAG } from './renderer/constants';
24+
import { NGT_DOM_PARENT_FLAG, NGT_PORTAL_CONTENT_FLAG } from './renderer/constants';
2525
import { injectStore, NGT_STORE } from './store';
2626
import type { NgtComputeFunction, NgtEventManager, NgtSize, NgtState, NgtViewport } from './types';
2727
import { is } from './utils/is';
@@ -97,11 +97,6 @@ export class NgtPortalContent {
9797
commentNode.data = NGT_PORTAL_CONTENT_FLAG;
9898
commentNode[NGT_PORTAL_CONTENT_FLAG] = store;
9999
commentNode[NGT_DOM_PARENT_FLAG] = host.nativeElement;
100-
101-
if (commentNode[NGT_INTERNAL_ADD_COMMENT_FLAG]) {
102-
commentNode[NGT_INTERNAL_ADD_COMMENT_FLAG]('portal', injector);
103-
delete commentNode[NGT_INTERNAL_ADD_COMMENT_FLAG];
104-
}
105100
}
106101
}
107102

libs/core/src/lib/renderer/renderer.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ export class NgtRendererFactory2 implements RendererFactory2 {
107107
export class NgtRenderer2 implements Renderer2 {
108108
private argsInjectors: Array<Injector> = [];
109109
private parentInjectors: Array<Injector> = [];
110-
private portalInjectors: Array<Injector> = [];
111110

112111
constructor(
113112
public delegateRenderer: Renderer2,
@@ -135,7 +134,6 @@ export class NgtRenderer2 implements Renderer2 {
135134
this.count = 0;
136135
this.argsInjectors = [];
137136
this.parentInjectors = [];
138-
this.portalInjectors = [];
139137
}
140138

141139
createElement(name: string, namespace?: string | null) {
@@ -220,7 +218,7 @@ export class NgtRenderer2 implements Renderer2 {
220218
// In our directives, we can call this function to then start tracking the RendererNode
221219
// this is done to limit the amount of Nodes we need to process for getCreationState
222220
Object.assign(commentRendererNode, {
223-
[NGT_INTERNAL_ADD_COMMENT_FLAG]: (type: 'args' | 'parent' | 'portal', injector: Injector) => {
221+
[NGT_INTERNAL_ADD_COMMENT_FLAG]: (type: 'args' | 'parent', injector: Injector) => {
224222
if (type === 'args') {
225223
this.argsInjectors.push(injector);
226224
} else if (type === 'parent') {
@@ -230,8 +228,6 @@ export class NgtRenderer2 implements Renderer2 {
230228
},
231229
});
232230
this.parentInjectors.push(injector);
233-
} else if (type === 'portal') {
234-
this.portalInjectors.push(injector);
235231
}
236232

237233
commentRendererNode.__ngt_renderer__[NgtRendererClassId.injector] = injector;

0 commit comments

Comments
 (0)