From ce43012480abe257532ecf684d13a306ea6b9128 Mon Sep 17 00:00:00 2001 From: carlosthe19916 <2582866+carlosthe19916@users.noreply.github.com> Date: Wed, 6 Sep 2023 11:06:17 +0200 Subject: [PATCH] Reuse search_params.clone() inside callbcak Signed-off-by: carlosthe19916 <2582866+carlosthe19916@users.noreply.github.com> --- spog/ui/src/components/advisory/search.rs | 3 +-- spog/ui/src/components/sbom/search.rs | 3 +-- spog/ui/src/pages/search.rs | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/spog/ui/src/components/advisory/search.rs b/spog/ui/src/components/advisory/search.rs index e0e8b5a3f..4c87d73f3 100644 --- a/spog/ui/src/components/advisory/search.rs +++ b/spog/ui/src/components/advisory/search.rs @@ -96,13 +96,12 @@ pub fn advisory_search(props: &AdvisorySearchProperties) -> Html { total.set(state.data().and_then(|d| d.total)); let onsort = { - let search_params_state = search_params.clone(); use_callback( move |sort_by: (String, bool), search_params| { if let SearchMode::Simple(simple) = &**search_params { let mut simple = simple.clone(); simple.set_sort_by(sort_by); - search_params_state.set(SearchMode::Simple(simple)); + search_params.set(SearchMode::Simple(simple)); }; }, search_params.clone(), diff --git a/spog/ui/src/components/sbom/search.rs b/spog/ui/src/components/sbom/search.rs index 8b639caa5..f74f1eabc 100644 --- a/spog/ui/src/components/sbom/search.rs +++ b/spog/ui/src/components/sbom/search.rs @@ -104,13 +104,12 @@ pub fn sbom_search(props: &SbomSearchProperties) -> Html { total.set(state.data().and_then(|d| d.total)); let onsort = { - let search_params_state = search_params.clone(); use_callback( move |sort_by: (String, bool), search_params| { if let SearchMode::Simple(simple) = &**search_params { let mut simple = simple.clone(); simple.set_sort_by(sort_by); - search_params_state.set(SearchMode::Simple(simple)); + search_params.set(SearchMode::Simple(simple)); }; }, search_params.clone(), diff --git a/spog/ui/src/pages/search.rs b/spog/ui/src/pages/search.rs index 0b32938d1..1652791c2 100644 --- a/spog/ui/src/pages/search.rs +++ b/spog/ui/src/pages/search.rs @@ -297,13 +297,12 @@ where let search = use_hook(search_params.clone(), pagination.clone(), callback); let onsort = { - let search_params_state = search_params.clone(); use_callback( move |sort_by: (String, bool), search_params| { if let SearchMode::Simple(simple) = &**search_params { let mut simple = simple.clone(); simple.set_sort_by(sort_by); - search_params_state.set(SearchMode::Simple(simple)); + search_params.set(SearchMode::Simple(simple)); }; }, search_params.clone(),