From 996435b79a1e43bd79aaab9ada014366e6b03ddd Mon Sep 17 00:00:00 2001 From: Marc Laval Date: Mon, 7 Jan 2019 10:38:55 +0100 Subject: [PATCH] refactor(ivy): remove TView.pipeDestroyHooks (#27955) PR Close #27955 --- packages/core/src/render3/instructions.ts | 1 - packages/core/src/render3/interfaces/view.ts | 11 ----------- packages/core/src/render3/node_manipulation.ts | 9 --------- packages/core/src/render3/pipe.ts | 3 +-- .../test/bundling/todo/bundle.golden_symbols.json | 3 --- 5 files changed, 1 insertion(+), 26 deletions(-) diff --git a/packages/core/src/render3/instructions.ts b/packages/core/src/render3/instructions.ts index 97e67366bf..4a248e0a67 100644 --- a/packages/core/src/render3/instructions.ts +++ b/packages/core/src/render3/instructions.ts @@ -725,7 +725,6 @@ export function createTView( viewHooks: null, viewCheckHooks: null, destroyHooks: null, - pipeDestroyHooks: null, cleanup: null, contentQueries: null, components: null, diff --git a/packages/core/src/render3/interfaces/view.ts b/packages/core/src/render3/interfaces/view.ts index 996415a284..11e36b84da 100644 --- a/packages/core/src/render3/interfaces/view.ts +++ b/packages/core/src/render3/interfaces/view.ts @@ -437,17 +437,6 @@ export interface TView { */ destroyHooks: HookData|null; - /** - * Array of pipe ngOnDestroy hooks that should be executed when this view is destroyed. - * - * Even indices: Index of pipe in data - * Odd indices: Hook function - * - * These must be stored separately from directive destroy hooks because their contexts - * are stored in data. - */ - pipeDestroyHooks: HookData|null; - /** * When a view is destroyed, listeners need to be released and outputs need to be * unsubscribed. This cleanup array stores both listener data (in chunks of 4) diff --git a/packages/core/src/render3/node_manipulation.ts b/packages/core/src/render3/node_manipulation.ts index a116f428d9..bd7834549e 100644 --- a/packages/core/src/render3/node_manipulation.ts +++ b/packages/core/src/render3/node_manipulation.ts @@ -427,7 +427,6 @@ function cleanUpView(viewOrContainer: LView | LContainer): void { if ((viewOrContainer as LView).length >= HEADER_OFFSET) { const view = viewOrContainer as LView; executeOnDestroys(view); - executePipeOnDestroys(view); removeListeners(view); const hostTNode = view[HOST_NODE]; // For component views only, the local renderer is destroyed as clean up time. @@ -486,14 +485,6 @@ function executeOnDestroys(view: LView): void { } } -/** Calls pipe destroy hooks for this view */ -function executePipeOnDestroys(lView: LView): void { - const pipeDestroyHooks = lView[TVIEW] && lView[TVIEW].pipeDestroyHooks; - if (pipeDestroyHooks) { - callHooks(lView !, pipeDestroyHooks); - } -} - export function getRenderParent(tNode: TNode, currentView: LView): RElement|null { if (canInsertNativeNode(tNode, currentView)) { // If we are asked for a render parent of the root component we need to do low-level DOM diff --git a/packages/core/src/render3/pipe.ts b/packages/core/src/render3/pipe.ts index 6808754c09..41703e1b62 100644 --- a/packages/core/src/render3/pipe.ts +++ b/packages/core/src/render3/pipe.ts @@ -33,8 +33,7 @@ export function pipe(index: number, pipeName: string): any { pipeDef = getPipeDef(pipeName, tView.pipeRegistry); tView.data[adjustedIndex] = pipeDef; if (pipeDef.onDestroy) { - (tView.pipeDestroyHooks || (tView.pipeDestroyHooks = [ - ])).push(adjustedIndex, pipeDef.onDestroy); + (tView.destroyHooks || (tView.destroyHooks = [])).push(adjustedIndex, pipeDef.onDestroy); } } else { pipeDef = tView.data[adjustedIndex] as PipeDef; diff --git a/packages/core/test/bundling/todo/bundle.golden_symbols.json b/packages/core/test/bundling/todo/bundle.golden_symbols.json index 0fa4fa446b..2b31d126af 100644 --- a/packages/core/test/bundling/todo/bundle.golden_symbols.json +++ b/packages/core/test/bundling/todo/bundle.golden_symbols.json @@ -584,9 +584,6 @@ { "name": "executeOnDestroys" }, - { - "name": "executePipeOnDestroys" - }, { "name": "extendStatics" },