()
| 156 | #currentEffectRef: EffectRef | null = null |
| 157 | |
| 158 | render() { |
| 159 | if (this.#shouldRecreateEntireView() && this.#currentEffectRef) { |
| 160 | this.#currentEffectRef.destroy() |
| 161 | this.#currentEffectRef = null |
| 162 | this.renderFlags &= ~FlexRenderFlags.RenderEffectChecked |
| 163 | } |
| 164 | |
| 165 | this.viewContainerRef.clear() |
| 166 | this.renderFlags = |
| 167 | FlexRenderFlags.Pristine | |
| 168 | (this.renderFlags & FlexRenderFlags.ViewFirstRender) | |
| 169 | (this.renderFlags & FlexRenderFlags.RenderEffectChecked) |
| 170 | |
| 171 | const resolvedContent = this.#getContentValue() |
| 172 | if (resolvedContent.kind === 'null') { |
| 173 | this.renderView = null |
| 174 | } else { |
| 175 | this.renderView = this.#renderViewByContent(resolvedContent) |
| 176 | } |
| 177 | |
| 178 | // If the content is a function `content(props)`, we initialize an effect |
| 179 | // in order to react to changes if the given definition use signals. |
| 180 | if (!this.#currentEffectRef && typeof this.content === 'function') { |
| 181 | this.#currentEffectRef = effect( |
| 182 | () => { |
| 183 | this.#latestContent() |
| 184 | if (!(this.renderFlags & FlexRenderFlags.RenderEffectChecked)) { |
| 185 | this.renderFlags |= FlexRenderFlags.RenderEffectChecked |
| 186 | return |
| 187 | } |
| 188 | this.renderFlags |= FlexRenderFlags.DirtySignal |
| 189 | // This will mark the view as changed, |
| 190 | // so we'll try to check for updates into ngDoCheck |
| 191 | this.#changeDetectorRef.markForCheck() |
| 192 | }, |
| 193 | { injector: this.viewContainerRef.injector } |
| 194 | ) |
| 195 | } |
| 196 | } |
| 197 | |
| 198 | #shouldRecreateEntireView() { |
| 199 | return ( |
no test coverage detected