gpui: Replace redundant code in animation (#19273)

Matin Aniss created

Just a small change to replace some redundant code in the animation
element.

Release Notes:

- N/A

Change summary

crates/gpui/src/elements/animation.rs | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)

Detailed changes

crates/gpui/src/elements/animation.rs 🔗

@@ -133,14 +133,7 @@ impl<E: IntoElement + 'static> Element for AnimationElement<E> {
             let mut element = (self.animator)(element, delta).into_any_element();
 
             if !done {
-                let parent_id = cx.parent_view_id();
-                cx.on_next_frame(move |cx| {
-                    if let Some(parent_id) = parent_id {
-                        cx.notify(parent_id)
-                    } else {
-                        cx.refresh()
-                    }
-                })
+                cx.request_animation_frame();
             }
 
             ((element.request_layout(cx), element), state)