-
-
Notifications
You must be signed in to change notification settings - Fork 121
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
updated() broken? #397
Comments
What I forgot: the context (and hence |
I have same problem |
Thanks for reporting, let me take a look. I have a theory, but I want to investigate some more to see what is going on. |
Ok, so what is happening is this: One worry I have is that it could create an infinite loop in some situations. For example, if |
I was changing the value from the front-end - just by clicking the "inc" button... |
I understand that. What I meant was setting a component property from the frontend, i.e. |
sure, one can call it manually if needed. |
I would like to know when the value of a particular state has changed through I would suggest having something like |
@roman-tiukh That's interesting! Any chance you can fork #407 and provide some code that I can use to replicate? Ideally with some comments for what you would expect to happen as well. Or add some failing tests to show your expectations. Thanks! |
I experience problems with the component's
update()
method. I created a simple test component, with onecounter
property and aninc()
method. And to update* methods:The html is just the
{{ counter }}
and a button that callsinc()
.Now, after first launch (counter=1) I would suspect that after clicking on the button, counter becomes 2, and the server should output 2 lines:
But instead, it outputs:
Problems:
updated()
method is never calledupdated_counter()
method always outputs the last (!) value - the one before the change happens.If i add another button with set
unicorn:click="counter=4"
in the button, and click oce the first (inc) button, and then that one, the output is:Ok, so after setting the property per frontend, at least the
updated()
method is called. But I would expect that when I do aself.counter += 1
too.And I don't know why the
updated_counter: 2
even is printed there. That's too late, it looks like it would have been waiting in a queue somewhere?I tried unicorn 0.44.1, 0.42.0, 0.40.0, 0.37.0 just to get a few versions
Any clues? Am I doing something terribly wrong, or is this a (really severe?) bug?
The text was updated successfully, but these errors were encountered: