-
-
Notifications
You must be signed in to change notification settings - Fork 51
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
Prop values in selectors - retrieving via an inline selector doesn't seem to work correctly #124
Comments
Ohhhh, you know what. I think I solved this issue. Looks like to get it to work I actually need to save a reference to the result of const instance = logic.build({ foo: 'foo' })
instance.mount();
console.log(instance.values.valueFromSelectorsProps);
//"foo" --- It works!
console.log(instance.values.valueFromInlineSelectorProps);
//"foo" --- It works! |
Hey, that's indeed the right approach. If you call |
I think the pain point for us here... is it appears that I now have to save a reference to the built logic to make this work. Is that correct? I cannot access these selectors via the wrapper? // wrapper
logic.build({ foo: 'foo' }).mount();
console.log(logic.values.valueFromInlineSelectorProps); vs. // built logic
const instance = logic.build({ foo: 'foo' })
instance.mount();
console.log(instance.values.valueFromInlineSelectorProps); It's a pain point just because we usually have the I think it's just really confusing that props are apparently available in selectors, via the wrapper, if you're accessing them with I guess I'm wondering if that is expected, or if it's potentially a bug, as it doesn't seem to be a documented behavior. Thanks for your help! |
Also just wanted to give you all a huge thank you for this project. We really love it! |
Fixed in 2.3.5 :) Turns out The And thanks for all the warm feedback! 😊 |
We are attempting to use a Prop inside of a Selector.
We're following this suggestion: https://kea.js.org/docs/guide/advanced#props-in-selectors
However, for whatever reason, we cannot seem to get access to props inside the inline selector as described in the documentation.
Here is a quick snippet I built on
https://npm.runkit.com/kea
to illustrate the issue.As you can see, I attempt to use the 2 different methods of accessing props as described in the docs. Both should work, right? For whatever reason though, I cannot get inline selector method to work.
Anyone have a second to take a look at this? Could just be user error.
The text was updated successfully, but these errors were encountered: