pzuraq / liquid-wormhole

Animated wormholes, built on Liquid Fire! Inspired by ember-wormhole
MIT License
20 stars 20 forks source link

fix: avoid updating `nodes` twice in same render (fix #70) #71

Closed jacobq closed 2 years ago

jacobq commented 4 years ago

Looks like removeWormhole can get called in the same cycle as didInsertELement, and both touch item.nodes, which triggers an error in Ember 3.22 that looks something like this:

Uncaught Error: Assertion Failed: You attempted to update `nodes` on `<EmberObject:ember169>`, 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.

`nodes` was first used:
....

To work around this for now (probably not the best way) we postpone the update to the next turn of the rendering loop. Note: I am not sure if this change may have other (negative) side-effects -- just saw that it made the other error go away....

jacobq commented 4 years ago

No idea why this one test fails: https://travis-ci.com/github/pzuraq/liquid-wormhole/jobs/403239645#L698 Fluke / re-run?

jacobq commented 2 years ago

Closing due to inactivity / age. May revisit while working out some other compatibility issues I'm having right now...