Merge pull request #159 from Baptistemontan/fixed_untyped_into

Fixed an untyped into causing compilation error
This commit is contained in:
Marc-Stefan Cassola 2024-08-23 17:59:53 +01:00 committed by GitHub
commit cc6a4ff541
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 10 additions and 14 deletions

View file

@ -64,7 +64,7 @@ where
fn with<O>(&self, f: impl FnOnce(&Option<T>) -> O) -> O {
match self {
Self::Static(t) => f(&t),
Self::Static(t) => f(t),
Self::Dynamic(s) => {
let value = s.get();
f(&value)
@ -75,7 +75,7 @@ where
fn try_with<O>(&self, f: impl FnOnce(&Option<T>) -> O) -> Option<O> {
match self {
Self::Static(t) => Some(f(&t)),
Self::Static(t) => Some(f(t)),
Self::Dynamic(s) => s.try_with(f),
_ => unreachable!(),
}
@ -90,7 +90,7 @@ where
fn with_untracked<O>(&self, f: impl FnOnce(&Option<T>) -> O) -> O {
match self {
Self::Static(t) => f(&t),
Self::Static(t) => f(t),
Self::Dynamic(s) => s.with_untracked(f),
_ => unreachable!(),
}
@ -98,7 +98,7 @@ where
fn try_with_untracked<O>(&self, f: impl FnOnce(&Option<T>) -> O) -> Option<O> {
match self {
Self::Static(t) => Some(f(&t)),
Self::Static(t) => Some(f(t)),
Self::Dynamic(s) => s.try_with_untracked(f),
_ => unreachable!(),
}

View file

@ -447,8 +447,8 @@ where
/// If specified this will override the default behavior.
/// To get the default behaviour back you can call the provided `default_handler` function.
/// It takes two parameters:
/// - `mode: ColorMode`: The color mode to change to.
/// -`default_handler: Arc<dyn Fn(ColorMode)>`: The default handler that would have been called if the `on_changed` handler had not been specified.
/// - `mode: ColorMode`: The color mode to change to.
/// -`default_handler: Arc<dyn Fn(ColorMode)>`: The default handler that would have been called if the `on_changed` handler had not been specified.
on_changed: OnChangedFn,
/// When provided, `useStorage` will be skipped.

View file

@ -52,12 +52,9 @@ where
{
use leptos::leptos_dom::helpers::TimeoutHandle;
use leptos::prelude::diagnostics::SpecialNonReactiveZone;
use std::cell::Cell;
use std::sync::{Arc, Mutex};
use std::time::Duration;
let delay = delay.into();
let timer = Arc::new(Mutex::new(None::<TimeoutHandle>));
let clear = {

View file

@ -64,7 +64,6 @@ pub fn use_web_notification_with_options(
let show = move |_: ShowOptions| ();
let close = move || ();
} else {
use leptos::{spawn::spawn_local, prelude::diagnostics::SpecialNonReactiveZone};
use crate::use_event_listener;
use leptos::ev::visibilitychange;
use wasm_bindgen::closure::Closure;
@ -75,7 +74,7 @@ pub fn use_web_notification_with_options(
let on_click = Rc::clone(&options.on_click);
move |e: web_sys::Event| {
#[cfg(debug_assertions)]
let _z = SpecialNonReactiveZone::enter();
let _z = leptos::prelude::diagnostics::SpecialNonReactiveZone::enter();
on_click(e);
}
@ -86,7 +85,7 @@ pub fn use_web_notification_with_options(
let on_close = Rc::clone(&options.on_close);
move |e: web_sys::Event| {
#[cfg(debug_assertions)]
let _z = SpecialNonReactiveZone::enter();
let _z = leptos::prelude::diagnostics::SpecialNonReactiveZone::enter();
on_close(e);
}
@ -97,7 +96,7 @@ pub fn use_web_notification_with_options(
let on_error = Rc::clone(&options.on_error);
move |e: web_sys::Event| {
#[cfg(debug_assertions)]
let _z = SpecialNonReactiveZone::enter();
let _z = leptos::prelude::diagnostics::SpecialNonReactiveZone::enter();
on_error(e);
}
@ -108,7 +107,7 @@ pub fn use_web_notification_with_options(
let on_show = Rc::clone(&options.on_show);
move |e: web_sys::Event| {
#[cfg(debug_assertions)]
let _z = SpecialNonReactiveZone::enter();
let _z = leptos::prelude::diagnostics::SpecialNonReactiveZone::enter();
on_show(e);
}