From ecc4f383896f831615b3f4c6abebbcf5382a8983 Mon Sep 17 00:00:00 2001 From: marc2332 Date: Wed, 29 May 2024 15:13:36 +0200 Subject: [PATCH] fix: Avoid clonning a provided context unnecessarily --- packages/hooks/src/use_context.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/hooks/src/use_context.rs b/packages/hooks/src/use_context.rs index 19ef6b734d..4e248e93ae 100644 --- a/packages/hooks/src/use_context.rs +++ b/packages/hooks/src/use_context.rs @@ -59,7 +59,6 @@ pub fn use_context() -> T { pub fn use_context_provider(f: impl FnOnce() -> T) -> T { use_hook(|| { let val = f(); - provide_context(val.clone()); - val + provide_context(val.clone()) }) }