-
Notifications
You must be signed in to change notification settings - Fork 0
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
Private to[Member]
member not properly setting state
#9
Comments
I think that the problem is that this really ought to be Because it's trying to coerce the string into an object which is why you end up with a Looking back, I think we were trying to be a little too cute with the ability to assign to the state This let you do things like say: this.toOtherState({merged: properties}) and it won't overwrite, but will instead merge with any of the properties that are stored in the value. In retrospect, I think this was too clever by half. |
Yeah the merging would be awesome. I want to use an object, actually, and was hoping it would do that (seems natural). I just tried with an object and ran into a couple more issues, I can open separate tickets if you like. I tried to make a PR but couldn't get to "working"... I think this line should be And I think the first two conditions (in the next 4 lines) are backwards (I think we want Even after making those changes, tho, I wasn't getting a merge or even my new value after the state transition so there must be something else I'm missing. |
I think you're right. Here's the thing though, you can always override the type of the value, in your actual union. class Base {
value = Merger;
}
export default Union({Pending: Base => class Pending extends Base {}}, Base); So maybe it makes sense to just make it |
Yes I see what you mean 👍 |
Good news is, if it's doesn't work, well we'll trying something else :) |
The example in the README wasn't working for me so I modified it a bit to extract some info about what is happening. I believe I'm doing this correctly.
The initial state value is
"foo"
. After theresolve
call the state value appears to be aString
type representation.I hope this is helpful.
The text was updated successfully, but these errors were encountered: