( slotIndex: number, matchingTemplateIndex: number, primaryTemplateIndex: number, )
| 80 | * logic into a shared utility function to reduce duplication. |
| 81 | */ |
| 82 | export function ɵɵboundaryUpdate( |
| 83 | slotIndex: number, |
| 84 | matchingTemplateIndex: number, |
| 85 | primaryTemplateIndex: number, |
| 86 | ) { |
| 87 | const hostLView = getLView(); |
| 88 | const bindingIndex = nextBindingIndex(); |
| 89 | const prevMatchingTemplateIndex: number = |
| 90 | hostLView[bindingIndex] !== NO_CHANGE ? hostLView[bindingIndex] : -1; |
| 91 | const prevContainer = |
| 92 | prevMatchingTemplateIndex !== -1 |
| 93 | ? getLContainer(hostLView, HEADER_OFFSET + prevMatchingTemplateIndex) |
| 94 | : undefined; |
| 95 | const viewInContainerIdx = 0; |
| 96 | |
| 97 | if (bindingUpdated(hostLView, bindingIndex, matchingTemplateIndex)) { |
| 98 | const prevConsumer = setActiveConsumer(null); |
| 99 | try { |
| 100 | if (prevContainer !== undefined) { |
| 101 | removeLViewFromLContainer(prevContainer, viewInContainerIdx); |
| 102 | } |
| 103 | |
| 104 | if (matchingTemplateIndex !== -1) { |
| 105 | const nextLContainerIndex = HEADER_OFFSET + matchingTemplateIndex; |
| 106 | const nextContainer = getLContainer(hostLView, nextLContainerIndex); |
| 107 | const templateTNode = getExistingTNode(hostLView[TVIEW], nextLContainerIndex); |
| 108 | |
| 109 | const dehydratedView = findAndReconcileMatchingDehydratedViews( |
| 110 | nextContainer, |
| 111 | templateTNode, |
| 112 | hostLView, |
| 113 | ); |
| 114 | |
| 115 | let embeddedLView: LView<any> | undefined; |
| 116 | try { |
| 117 | const boundary = hostLView[HEADER_OFFSET + slotIndex] as LBoundary; |
| 118 | const context = |
| 119 | matchingTemplateIndex === primaryTemplateIndex |
| 120 | ? undefined |
| 121 | : {$error: boundary.error, $reset: createBoundaryResetFn(boundary)}; |
| 122 | embeddedLView = createAndRenderEmbeddedLView(hostLView, templateTNode, context, { |
| 123 | dehydratedView, |
| 124 | }); |
| 125 | |
| 126 | if (matchingTemplateIndex === primaryTemplateIndex) { |
| 127 | embeddedLView[ON_ERROR] = (error: Error, details: ErrorDetails) => { |
| 128 | const boundary = hostLView[HEADER_OFFSET + slotIndex] as LBoundary; |
| 129 | boundary.error = error; |
| 130 | |
| 131 | const errorHandler = hostLView[INJECTOR]?.get(ErrorHandler, null); |
| 132 | if (errorHandler) { |
| 133 | const boundaryComponentView = hostLView[DECLARATION_COMPONENT_VIEW][CONTEXT] as any; |
| 134 | const boundaryType: Type<unknown> = boundaryComponentView.constructor; |
| 135 | (details as Writable<ErrorDetails>).boundary = { |
| 136 | type: boundaryType, |
| 137 | reset: createBoundaryResetFn(boundary), |
| 138 | }; |
| 139 |
nothing calls this directly
no test coverage detected