Skip to content

Commit

Permalink
fix use_websocket reconnect_limit defaults to for infinite retries, fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jetli committed May 26, 2024
1 parent ef15d7b commit 2729929
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
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 @@ -33,7 +33,7 @@ pub struct UseWebSocketOptions {
/// `WebSocket` close callback.
pub onclose: Option<Box<dyn FnMut(CloseEvent)>>,

/// Retry times. Defaults to 3, use `u32::MAX` for infinite retries.
/// Retry times. Defaults to `u32::MAX` for infinite retries.
pub reconnect_limit: Option<u32>,
/// Retry interval(ms). Defaults to 3000.
pub reconnect_interval: Option<u32>,
Expand Down Expand Up @@ -235,7 +235,7 @@ pub fn use_websocket_with_options(url: String, options: UseWebSocketOptions) ->
let onmessage_bytes_ref = use_mut_latest(options.onmessage_bytes);
let onerror_ref = use_mut_latest(options.onerror);
let onclose_ref = use_mut_latest(options.onclose);
let reconnect_limit = options.reconnect_limit.unwrap_or(3);
let reconnect_limit = options.reconnect_limit.unwrap_or(u32::MAX);
let reconnect_interval = options.reconnect_interval.unwrap_or(3 * 1000);
let manual = options.manual.unwrap_or(false);
let protocols = options.protocols;
Expand Down
1 change: 1 addition & 0 deletions crates/yew-hooks/src/web_sys_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//! which is inconvenient, so copy the binding code here for now.
#![allow(unused_imports)]
#![allow(clippy::unused_unit)]
#![allow(clippy::empty_docs)]
use wasm_bindgen::{self, prelude::*};
use web_sys::{DataTransfer, DomRectReadOnly, Element, Event, EventTarget};

Expand Down

0 comments on commit 2729929

Please sign in to comment.