Closed josemarluedke closed 4 years ago
@josemarluedke Happen to know if it tracks back to your codebase or do all signs point to this addon?
I certainly have seen this many times and I know work has been done in emberjs to address some of these things. Also here is an ember-data issue with similar problems (only in development). There is still one PR to land below as well.
https://github.com/emberjs/data/issues/7196 https://github.com/glimmerjs/glimmer-vm/pull/1111
@snewcomer I apologize. You are right, the issues were not in the addon itself, but rather how I was interacting with it.
I had two main issues:
changeset.set
on my component constructor.I do wonder if the second issue could be avoided somehow in the addon?
Thanks for quickly confirming that there were no issues in the addon.
It is an interesting question. I can see both sides. I might lean one way though. Since these errors can be triggered with an infinite number of user land examples and is a necessity in protecting data integrity, my feeling is it should always be on the user. We might be chasing our tail if any data mutation hook needed to protect against this scenario.
Hi, @snewcomer. After upgrading ember-source
from v3.22.0
to v3.22.1
in my app, I'm still encountering the error message when I press the Enter key to save a changeset.
You attempted to update `_errors` on `changeset:[object Object]`, but it had already been used previously in the same computation. Attempting to update a value after using it in a computation can cause logical errors, infinite revalidation bugs, and performance issues, and is not supported.
In order for this message to go away, would ember-changeset
or ember-changeset-validations
itself need to use ember-source v3.22.1
(i.e. would a new release be needed)?
@snewcomer I realized that the error was my fault, my apologies.
I was updating the changeset on an input's focusout
event as well as Enter
key press. When I submitted the input by pressing Enter and made a route transition afterwards, the input field lost focus, triggering the focusout
event. I believe this caused the changeset to update twice instead of once.
Hi everyone.
I'm trying to upgrade one of our app to Ember v3.22 and seeing a lot of this deprecations. I'm just creating a changeset and setting value to a property.
What's the best way to avoid this? @snewcomer
DEPRECATION: You attempted to update
_changeson
changeset:[object Object], but it had already been used previously in the same computation. Attempting to update a value after using it in a computation can cause logical errors, infinite revalidation bugs, and performance issues, and is not supported.
Thanks.
@sinankeskin 👋 This is similar to this case. You might have to adjust when/how the changes is created then updated. The problem is something was read-then-written in the same computation in the same "tick".
@sinankeskin 👋 This is similar to this case. You might have to adjust when/how the changes is created then updated. The problem is something was read-then-written in the same computation in the same "tick".
I've fixed this with a creating middle classes. Works perfect now. Thanks a lot @snewcomer Appreciated.
Just tried upgrading an app to Ember v3.22 and started getting some errors in changeset.
The same happens with
_errors
as well.Version
changeset v 3.8.2 (also tested with latest version but same occurs. ) ember v 3.22