Giter Site home page Giter Site logo

Comments (5)

maccesch avatar maccesch commented on July 4, 2024

Thanks for the kind words. Could you post the code where you use it?

from leptos-use.

JosiahParry avatar JosiahParry commented on July 4, 2024

of course! this is the only location where I use the cookie:

pub fn get_signed_in_signals() -> (Signal<Option<bool>>, WriteSignal<Option<bool>>) {
    let (cookie, set_cookie) = use_cookie_with_options::<bool, FromToStringCodec>(
        "signed_in",
        UseCookieOptions::default()
            .max_age(86400_000) // one day
            .same_site(SameSite::Strict),
    );

    if cookie().is_none() {
        set_cookie.set(Some(false));
    }

    (cookie, set_cookie)
}

from leptos-use.

maccesch avatar maccesch commented on July 4, 2024

The warning should be gone if you change the line

    if cookie().is_none() {

to

    if cookie.get_untracked().is_none() {

Or make sure that you use your function always in a reactive context which I'm pretty sure you're not doing right now.

from leptos-use.

JosiahParry avatar JosiahParry commented on July 4, 2024

Ah, okay! So I am using the setters and getters in a reactive context but since the instantiation of them is not reactive, the warning is shown. Warnings gone :)

Odd that the warning didn't reference the file where it came from! Sorry about that.

from leptos-use.

maccesch avatar maccesch commented on July 4, 2024

No worries! I'm glad you were able to find it.

from leptos-use.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.