Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

in yew version = "0.21.0" and yewdux = "0.9.3" error will generated #61

Closed
ghost opened this issue Oct 3, 2023 · 3 comments · Fixed by #62
Closed

in yew version = "0.21.0" and yewdux = "0.9.3" error will generated #61

ghost opened this issue Oct 3, 2023 · 3 comments · Fixed by #62

Comments

@ghost
Copy link

ghost commented Oct 3, 2023

in use_store
let (store, dispatch):(Rc,Dispatch) = use_store::();
Error: the trait bound impl yew::functional::hooks::Hook<Output = (Rc<store::Store>, yewdux::dispatch::Dispatch<store::Store>)> + '_: Hook is not satisfied
the trait Hook is implemented for BoxedHook<'_, T>

@intendednull
Copy link
Owner

The Yew version needs to be updated. Should have some time soon to release a fix

@xeho91
Copy link

xeho91 commented Oct 5, 2023

The Yew version needs to be updated. Should have some time soon to release a fix

From what I found out, updating yew to v0.21.0 is not going to be enough.

There has been some breaking changes, see: yewstack/yew#3289.

I'm receiving other error, let me quickly give a sample:

#[derive(Clone, Debug, Default, PartialEq, yewdux::store::Store)]
pub struct StateSprites(RefCell<HashMap<String, SpriteData>>);

pub enum SpritesManagerMsg {
    SpritesInjected(Rc<StateSprites>),
}

pub struct SpritesManager {
    _state_listener: Dispatch<StateSprites>,
    state: Rc<StateSprites>,
    element: Element,
}

impl SpritesManager {
    const ID: &'static str = "svg-sprites";
}

impl yew::Component for SpritesManager {
    type Message = SpritesManagerMsg;
    type Properties = ();

    fn create(ctx: &yew::Context<Self>) -> Self {
        let cb = ctx.link().callback(Self::Message::SpritesInjected);
        let dispatch = Dispatch::<StateSprites>::subscribe(cb);

        // Redacted to for simplification
    }
    
    // Rest is redacted to for simplification
}

I'm receiving this error message on the:
let dispatch = Dispatch::<StateSprites>::subscribe(cb);

Diagnostics:
1. expected a `std::ops::Fn<(std::rc::Rc<utils::sprites::store::StateSprites>,)>` closure, found `yew::Callback<std::rc::Rc<utils::sprites::store::StateSprites>>`
   the trait `std::ops::Fn<(std::rc::Rc<utils::sprites::store::StateSprites>,)>` is not implemented for `yew::Callback<std::rc::Rc<utils::sprites::store::StateSprites>>`
   the trait `yewdux::subscriber::Callable<S>` is implemented for `yew::callback::Callback<std::rc::Rc<S>>`
   required for `yew::Callback<std::rc::Rc<utils::sprites::store::StateSprites>>` to implement `yewdux::subscriber::Callable<utils::sprites::store::StateSprites>` [E0277]
2. required by a bound introduced by this call [E0277]

@amiyatulu
Copy link

Any updates? I am too getting the same error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants