Skip to content

Commit

Permalink
fix cargo test (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
jetli authored May 26, 2024
1 parent c7827c7 commit 6554ce0
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -330,14 +330,14 @@ pub fn web_socket() -> Html {
{
let history = history.clone();
let ws = ws.clone();
use_effect_with_deps(
use_effect_with(
ws.message,
move |message| {
if let Some(message) = &**message {
history.push(format!("[recv]: {}", message.clone()));
}
|| ()
},
ws.message,
);
}

Expand Down
2 changes: 1 addition & 1 deletion crates/yew-hooks/src/hooks/use_effect_update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ where
}

/// This hook is similar to [`use_effect_update`] but it accepts dependencies.
/// The signature is exactly the same as the [`use_effect_with_deps`] hook.
/// The signature is exactly the same as the [`use_effect_with`] hook.
#[hook]
pub fn use_effect_update_with_deps<Callback, Destructor, Dependents>(
callback: Callback,
Expand Down
8 changes: 4 additions & 4 deletions crates/yew-hooks/src/hooks/use_latest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@ where
///
/// let latest_closure = use_mut_latest(closure);
///
/// use_effect_with_deps(move |_| {
/// use_effect_with((), move |_| {
/// *interval.borrow_mut() = Some(Interval::new(1000, move || {
/// let latest_closure = latest_closure.current();
/// let closure = &*latest_closure.borrow_mut();
/// // This will get the latest closure and increase state by 1 each time.
/// closure();
/// }));
/// move || *interval.borrow_mut() = None
/// }, ());
/// });
///
/// html! {
/// <div>
Expand Down Expand Up @@ -135,13 +135,13 @@ where
///
/// {
/// let state = state.clone();
/// use_effect_with_deps(move |_| {
/// use_effect_with((), move |_| {
/// *interval.borrow_mut() = Some(Interval::new(1000, move || {
/// // This will get the latest state and increase it by 1 each time.
/// state.set(**latest_state.current() + 1);
/// }));
/// move || *interval.borrow_mut() = None
/// }, ());
/// });
/// }
///
/// html! {
Expand Down
4 changes: 2 additions & 2 deletions crates/yew-hooks/src/hooks/use_swipe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ impl Clone for UseSwipeHandle {
/// // You can depend on direction/swiping etc.
/// {
/// let state = state.clone();
/// use_effect_with_deps(move |direction| {
/// use_effect_with(state.direction, move |direction| {
/// // Do something based on direction.
/// match **direction {
/// UseSwipeDirection::Left => (),
Expand All @@ -74,7 +74,7 @@ impl Clone for UseSwipeHandle {
/// _ => (),
/// }
/// || ()
/// }, state.direction);
/// });
/// }
///
/// html! {
Expand Down
4 changes: 2 additions & 2 deletions crates/yew-hooks/src/hooks/use_websocket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,14 @@ impl Clone for UseWebSocketHandle {
/// let history = history.clone();
/// let ws = ws.clone();
/// // Receive message by depending on `ws.message`.
/// use_effect_with_deps(
/// use_effect_with(
/// ws.message,
/// move |message| {
/// if let Some(message) = &**message {
/// history.push(format!("[recv]: {}", message.clone()));
/// }
/// || ()
/// },
/// ws.message,
/// );
/// }
///
Expand Down
2 changes: 1 addition & 1 deletion examples/yew-app/src/app/hooks/use_effect_update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub fn UseEffectUpdate() -> Html {
{
let count_effect_update = count_effect_update.clone();
let count = count.clone();
// Count for use_effect_update_with_deps is less than use_effect_with_deps by 1.
// Count for use_effect_update_with_deps is less than use_effect_with by 1.
use_effect_update_with_deps(
move |_| {
count_effect_update.set(*count_effect_update + 1);
Expand Down

0 comments on commit 6554ce0

Please sign in to comment.