diff --git a/CHANGELOG.md b/CHANGELOG.md
index 10cbac4..54320a0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,7 +3,7 @@
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
-## [Unreleased]
+## [0.3.1] - 2023-06-15
### New Functions 🚀
diff --git a/Cargo.toml b/Cargo.toml
index 2a8449d..fc192cb 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "leptos-use"
-version = "0.3.0"
+version = "0.3.1"
edition = "2021"
authors = ["Marc-Stefan Cassola"]
categories = ["gui", "web-programming"]
diff --git a/README.md b/README.md
index b2badad..4d92886 100644
--- a/README.md
+++ b/README.md
@@ -12,7 +12,7 @@
-
+
diff --git a/docs/book/src/introduction.md b/docs/book/src/introduction.md
index e9edaf1..f97fb48 100644
--- a/docs/book/src/introduction.md
+++ b/docs/book/src/introduction.md
@@ -11,6 +11,6 @@
-
+
\ No newline at end of file
diff --git a/examples/use_interval/src/main.rs b/examples/use_interval/src/main.rs
index cceb368..d37aaf5 100644
--- a/examples/use_interval/src/main.rs
+++ b/examples/use_interval/src/main.rs
@@ -4,19 +4,11 @@ use leptos_use::{use_interval, UseIntervalReturn};
#[component]
fn Demo(cx: Scope) -> impl IntoView {
- let UseIntervalReturn {
- counter,
- reset,
- is_active,
- pause,
- resume
- } = use_interval(cx, 200);
-
- let (counter_read, _) = create_signal(cx, move || counter());
+ let UseIntervalReturn { counter, .. } = use_interval(cx, 200);
view! { cx,
-
"Interval fired: " { counter_read() }
+
"Interval fired: " { counter }
}
}
diff --git a/src/use_interval.rs b/src/use_interval.rs
index 43e1726..a6db996 100644
--- a/src/use_interval.rs
+++ b/src/use_interval.rs
@@ -1,12 +1,8 @@
-use crate::utils::{CloneableFn, CloneableFnWithArg, Pausable};
-use crate::{use_interval_fn, use_interval_fn_with_options, watch, UseIntervalFnOptions};
+use crate::utils::{CloneableFnWithArg, Pausable};
+use crate::{use_interval_fn_with_options, UseIntervalFnOptions};
use default_struct_builder::DefaultBuilder;
-use leptos::leptos_dom::helpers::IntervalHandle;
+
use leptos::*;
-use std::cell::Cell;
-use std::marker::PhantomData;
-use std::rc::Rc;
-use std::time::Duration;
/// Reactive counter increases on every interval.
///
@@ -103,7 +99,7 @@ pub struct UseIntervalOptions {
impl Default for UseIntervalOptions {
fn default() -> Self {
Self {
- immediate: false,
+ immediate: true,
callback: Box::new(|_: u64| {}),
}
}
diff --git a/src/utils/pausable.rs b/src/utils/pausable.rs
index 3a1dc34..36e0dda 100644
--- a/src/utils/pausable.rs
+++ b/src/utils/pausable.rs
@@ -1,5 +1,4 @@
-use std::cell::Cell;
-use leptos::{ReadSignal, Signal};
+use leptos::Signal;
/// Pausable effect
pub struct Pausable