question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[3.4.0-beta.2] Cannot update watchers for `isVisible` on component teardown

See original GitHub issue

I’m not sure if I will be able to come up with a concrete, independent reproduction but in the latest 3.4.0 beta I am seeing an error in code that has worked in previous versions of Ember.

The code in question is a computed property on a component where chart.graphs is an array of components.

visibleSiblingGraphs: filterBy('chart.graphs', 'isVisible'),

This triggers this error when, I think, this component is being torn down.

Error: Assertion Failed: Cannot update watchers for `isVisible` on `<my-app@component:my-component::ember1016>` after it has been destroyed.
    at new EmberError (index.js:37)
    at assert (index.js:125)
    at Meta.writeWatching (meta.js:279)
    at unwatchKey (ember-metal.js:1010)
    at unwatch (ember-metal.js:2010)
    at removeObserver (ember-metal.js:1511)
    at removeObserverForContentKey (ember-metal.js:1619)
    at EachProxy.stopObservingContentKey (ember-metal.js:1594)
    at EachProxy.didUnwatchProperty (ember-metal.js:1571)
    at unwatchKey (ember-metal.js:978)

For reasons that aren’t clear to me, if I switch to using filter I no longer get the error:

visibleSiblingGraphs: filter('chart.graphs', function(graph) {
    return graph.get('isVisible');
  }),

I’m sure we have many other instances of filterBy in use so something odd must be happening for this case that I can’t quite ascertain just yet, but I thought it would helpful to open something in case anybody has any ideas.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
danielspanielcommented, Oct 9, 2018

interesting … i found the problem but it might not be a bug bug in ember.

case 1] for ember simple auth after signing up i assign the user to a service ( let’s call it auth )

export default class Auth extends Service {
 @reads('currentUser.company') currentCompany
  
 // after sign up do this 
  async loadCurrentUser(userId) {
      const user = await this.store.findRecord('user', userId);
      this.set('currentUser', user);
   }
}

so, lets say that other components are binding to auth.currentUser
with the usual

 @reads('auth.currentUser') currentUser 

or maybe a

@reads('auth.currentUser.email') currentUserEmail 

and then later you sign out with your basic

   async signOut() {
      await this.session.invalidate();
      this.transitionTo('sign-in');
}

then its fine, and then you sign in again and blam, you get the error it’s like that old user model is still attatched to the auth service ( obviously ) but is now in destroyed state and before the new user model ( that is loaded ) can replace it, blah … ember barfs trying to setup watchers on the old user

the solution is to be more mouse like and tip toe around the problem.

 async signOut() {
    this.auth.unloadUser(); // in auth service this method does:  this.set('currentUser, null); 
    await this.session.invalidate();
    this.transitionTo('sign-in');
}

and voila … problem solved.

case 2] i have an array of models in a weakMap and a component is using that array, and later those models are destroyed. the component freaks out. the answer there is to be more mouselike and before i destroy those array of models to tip toe over to that weakmap and clear them from the array.

0reactions
lockscommented, Dec 4, 2020

isVisible is now deprecated, and not present in Glimmer components, so I’m closing this issue. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

[3.4.0-beta.2] Cannot update watchers for `isVisible` on component ...
[3.4.0-beta.2] Cannot update watchers for `isVisible` on component teardown. ... but in the latest 3.4.0 beta I am seeing an error in code...
Read more >
Assertion Failed Error: In Ember When Api Is Called ... - ADocLib
[3.4.0-beta.2] Cannot update watchers for `isVisible` on component teardown. I'm not sure if I will be able to come up with a concrete,...
Read more >
onsenui - UNPKG
It allows importing specific components instead of the whole bundle. ... 339, * Fixed glitch during push/pop animation when iOS status bar is...
Read more >
gerrit - Git at Google
It doesn't allow any other update of +references. + +Deletion of references is also possible if `Push` with the force option +is granted,...
Read more >
OMNeT++ - Index of
2 Overview. 3. 3 The NED Language. 11. 4 Simple Modules. 47. 5 Messages and Packets. 119. 6 Message Definitions. 129. 7 The...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found