Skip to content

Commit

Permalink
feat: optimize empty composables by not creating ScopeData
Browse files Browse the repository at this point in the history
  • Loading branch information
matthunz committed Dec 3, 2024
1 parent 497022a commit 0e8c9dc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/compose.rs
Original file line number Diff line number Diff line change
Expand Up @@ -512,13 +512,13 @@ where
// Safety: This cell is only accessed by this composable.
let cell = unsafe { &mut *cell.get() };

// Scope for this composable's content.
let child_state = use_ref(&cx, ScopeData::default);

if typeid::of::<C>() == typeid::of::<()>() {
return;
}

// Scope for this composable's content.
let child_state = use_ref(&cx, ScopeData::default);

if cell.is_none()
|| cx.is_changed.take()
|| cx.is_parent_changed.get()
Expand Down

0 comments on commit 0e8c9dc

Please sign in to comment.