mercredi 23 septembre 2020

Cannot update tracked property via did-update in Ember JS

I am trying to use did-update in my template to trigger an action within my component from another component. I have done this before but never with an action that updated a tracked property.

I am trying to show a modal window whose display relies on the tracked property.

I have tried with another tracked property that is not called in another function in that component and I get the same error.

Is it at all possible to update a tracked property through this method?

// template


// component
@tracked isShareOpen = false;
@action
triggerShare() {
  this.isShareOpen = !this.isShareOpen;
}

I am getting the following error

index.js:172 Uncaught (in promise) Error: Assertion Failed: You attempted to update `isShareOpen` on `ListingShareComponent`, 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.

`isShareOpen` was first used:

- While rendering:
  ----------------
    (instance of a `(unknown object)` modifier)



Aucun commentaire:

Enregistrer un commentaire