()
| 243 | // The dispose function is referenced by both the returned Effect object |
| 244 | // and the onSourceError callback, so we define it first. |
| 245 | const dispose = async () => { |
| 246 | if (disposed) return |
| 247 | disposed = true |
| 248 | |
| 249 | // Abort signal for in-flight handlers |
| 250 | abortController.abort() |
| 251 | |
| 252 | // Tear down the pipeline (unsubscribe from sources, etc.) |
| 253 | runner.dispose() |
| 254 | |
| 255 | // Wait for any in-flight async handlers to settle |
| 256 | if (inFlightHandlers.size > 0) { |
| 257 | await Promise.allSettled([...inFlightHandlers]) |
| 258 | } |
| 259 | } |
| 260 | |
| 261 | // Create and start the pipeline |
| 262 | const runner = new EffectPipelineRunner<TRow, TKey>({ |
searching dependent graphs…