onCleanup Disposal Compatibility Boundary in SolidJS
0 reputation · 08 Jun 2025, 15:52 UTC
This question addresses the coordination of onCleanup disposal callbacks with in-flight asynchronous operations when a reactive owner is torn down in SolidJS. The goal is to determine whether a pending network request, timer, or promise started inside a createEffect can safely be terminated before the owner's disposal completes, without leaving orphan signal writes or unhandled callbacks.
Documented behavior in SolidJS core reactivity indicates that onCleanup registers callbacks scoped to the current reactive owner and executes synchronously at disposal, but the framework does not automatically await or cancel promises, timers, or HTTP requests created inside effects. No built-in effect option exists to auto-abort linked asynchronous tasks. Behavior across major versions and SolidStart server/client boundaries has not been explicitly codified, leaving developers to pair onCleanup manually with AbortController or custom cancellation flags; this aspect should be confirmed against the installed release.
- What ensures a fetch initiated in an effect is aborted before the reactive owner disposes?
- Whether a timer set inside
createEffectstill fires afteronCleanupcallbacks have run. - Influence of a schema mutation mid-effect on the disposal sequence in recent SolidJS versions.