From 2ff9f1f23460598f9e97c3cc7768374f4ce91e71 Mon Sep 17 00:00:00 2001 From: Luke Chu <37006668+lukechu10@users.noreply.github.com> Date: Wed, 10 Mar 2021 10:15:17 -0800 Subject: [PATCH] Add doc comment to cleanup_running --- maple-core/src/reactive.rs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/maple-core/src/reactive.rs b/maple-core/src/reactive.rs index 261b53f5d..67d86f4d6 100644 --- a/maple-core/src/reactive.rs +++ b/maple-core/src/reactive.rs @@ -229,6 +229,7 @@ impl AnySignalInner for RefCell> { } } +/// Unsubscribes from all the dependencies in [`Running`]. fn cleanup_running(running: &Rc>>) { let execute = running.borrow().as_ref().unwrap().execute.clone(); @@ -302,16 +303,10 @@ where effect(); // attach dependencies - for dependency in &contexts - .borrow() - .last() - .unwrap() - .borrow() - .as_ref() - .unwrap() - .dependencies - { - dependency.0.subscribe(running.borrow().as_ref().unwrap().execute.clone()); + for dependency in &running.borrow().as_ref().unwrap().dependencies { + dependency + .0 + .subscribe(running.borrow().as_ref().unwrap().execute.clone()); } contexts.borrow_mut().pop();