(this: EffectNode)
| 233 | }, |
| 234 | |
| 235 | cleanup(this: EffectNode): void { |
| 236 | if (!this.cleanupFns?.length) { |
| 237 | return; |
| 238 | } |
| 239 | const prevConsumer = setActiveConsumer(null); |
| 240 | try { |
| 241 | // Attempt to run the cleanup functions. Regardless of failure or success, we consider |
| 242 | // cleanup "completed" and clear the list for the next run of the effect. Note that an error |
| 243 | // from the cleanup function will still crash the current run of the effect. |
| 244 | while (this.cleanupFns.length) { |
| 245 | this.cleanupFns.pop()!(); |
| 246 | } |
| 247 | } finally { |
| 248 | this.cleanupFns = []; |
| 249 | setActiveConsumer(prevConsumer); |
| 250 | } |
| 251 | }, |
| 252 | }))(); |
| 253 | |
| 254 | export const ROOT_EFFECT_NODE: Omit<RootEffectNode, 'fn' | 'scheduler' | 'notifier' | 'injector'> = |
nothing calls this directly
no test coverage detected
searching dependent graphs…