Skip to content

Commit bf16336

Browse files
committed
changed reload controller to Trigger
1 parent 5547bfe commit bf16336

File tree

2 files changed

+6
-14
lines changed

2 files changed

+6
-14
lines changed

src/components/table_content.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ where
224224

225225
create_effect(move |_| {
226226
// triggered when `ReloadController::reload()` is called
227-
reload_controller.get();
227+
reload_controller.track();
228228
clear();
229229
});
230230

src/reload_controller.rs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,20 @@ use leptos::*;
55
/// See the [paginated_rest_datasource example](https://github.com/Synphonyte/leptos-struct-table/blob/master/examples/paginated_rest_datasource/src/main.rs)
66
/// for how to use.
77
#[derive(Copy, Clone)]
8-
pub struct ReloadController(RwSignal<()>);
8+
pub struct ReloadController(Trigger);
99

1010
impl Default for ReloadController {
1111
fn default() -> Self {
12-
Self(create_rw_signal(()))
12+
Self(create_trigger())
1313
}
1414
}
1515

1616
impl ReloadController {
1717
pub fn reload(&self) {
18-
self.0.set(());
19-
}
20-
}
21-
22-
impl SignalGet for ReloadController {
23-
type Value = ();
24-
25-
fn get(&self) -> () {
26-
self.0.get()
18+
self.0.notify();
2719
}
2820

29-
fn try_get(&self) -> Option<Self::Value> {
30-
self.0.try_get()
21+
pub fn track(&self) {
22+
self.0.track();
3123
}
3224
}

0 commit comments

Comments
 (0)