Skip to content

Commit

Permalink
Remove recursive registering of events
Browse files Browse the repository at this point in the history
The ext-event-handlers registers triggers to be handled in the idle of the app,
so the effect can never run recursively
  • Loading branch information
sgued committed Aug 10, 2024
1 parent e1a0337 commit 18be785
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/ext_event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,7 @@ pub fn create_signal_from_stream<T: 'static>(
// Run the effect when the waker is called
trigger.track();
let Ok(mut stream) = stream.try_borrow_mut() else {
// Race condition, we need to re-schedule-add the trigger?
// I'm not sure if this does not risks creating an infinite loop if the effect is re-run before it is itself over
// TODO: test with stream where the implementation returns pending but calls the waker immediately
EXT_EVENT_HANDLER.add_trigger(arc_trigger.0);
return;
unreachable!("The waker registers events effecs to be run only at idle")
};

let waker = waker(arc_trigger.clone());
Expand Down

0 comments on commit 18be785

Please sign in to comment.