diff --git a/crates/gpui/src/window.rs b/crates/gpui/src/window.rs index b5a2faab92..5276fb15dc 100644 --- a/crates/gpui/src/window.rs +++ b/crates/gpui/src/window.rs @@ -3357,6 +3357,8 @@ impl Window { } /// Use a piece of state that exists as long this element is being rendered in consecutive frames. + /// + /// This method should only be called during `Render::render`, `RenderOnce::render`, or the drawing functions of `Element`. pub fn use_keyed_state( &mut self, key: impl Into, @@ -3401,7 +3403,9 @@ impl Window { /// Updates or initializes state for an element with the given id that lives across multiple /// frames. If an element with this ID existed in the rendered frame, its state will be passed /// to the given closure. The state returned by the closure will be stored so it can be referenced - /// when drawing the next frame. This method should only be called as part of element drawing. + /// when drawing the next frame. + /// + /// This method should only be called during `Render::render`, `RenderOnce::render`, or the drawing functions of `Element`. pub fn with_element_state( &mut self, global_id: &GlobalElementId, @@ -3531,6 +3535,8 @@ impl Window { /// persist across renders as long as the key remains the same. This is the /// recommended method for most use cases where you want smooth, continuous /// animations. + /// + /// This method should only be called during `Render::render`, `RenderOnce::render`, or the drawing functions of `Element`. pub fn use_keyed_transition( &mut self, key: impl Into,