Closed Johennes closed 3 weeks ago
A common use case for AbortController is to cancel async operations that were started via the useEffect hook.
AbortController
useEffect
useEffect(() => { const controller = new AbortController(); async function loadLatestEvent() { if (!item.isTimelineInitialized()) { await item.initTimeline(undefined, undefined, { signal: controller.signal }); } ... } loadLatestEvent().catch(...); return () => { controller.abort(); } }, [item]);
This appears to cause a crash when the clean-up callback runs after the promise has completed.
Thread 2 Crashed:: com.facebook.react.runtime.JavaScript 0 unomed_mobile.debug.dylib 0x10f28c9d0 ffi_matrix_sdk_base_rust_future_cancel_f32 + 44
The code generated by UBRN should be able to recognise this situation and simply do nothing if the abort signal arrives after the task completed.
A common use case for
AbortController
is to cancel async operations that were started via theuseEffect
hook.This appears to cause a crash when the clean-up callback runs after the promise has completed.
The code generated by UBRN should be able to recognise this situation and simply do nothing if the abort signal arrives after the task completed.