ember-native-class-codemod icon indicating copy to clipboard operation
ember-native-class-codemod copied to clipboard

Attempted to access the computed <Obj>.computedPropName on a destroyed object errors in acceptance tests after running this codemod

Open tomwayson opened this issue 4 years ago • 2 comments

After running this codemod and cleaning up linting, unit, and integration test errors, I'm left w/ a couple of consistently failing acceptance tests w/ errors that look like:

Error: Assertion Failed: Attempted to access the computed <opendata-ui@service:app-settings::ember12998>.isHub on a destroyed object, which is not allowed
     at assert (https://localhost:4201/assets/vendor.js:52828:15)     at ComputedProperty.get (https://localhost:4201/assets/vendor.js:32061:120)
     at AppSettingsService.CPGETTER_FUNCTION [as isHub] (https://localhost:4201/assets/vendor.js:30210:25)
     at ActionsMenuService.getFollowButtonConfig (https://localhost:4201/assets/opendata-ui.js:40260:9)
     at ActionsMenuService.getConfig (https://localhost:4201/assets/opendata-ui.js:40204:39)
     at async Class.setActionsMenuConfig (https://localhost:4201/assets/opendata-ui.js:31149:22)

Here's the diff from before/after running the codemod for that CP:

-  }),
-  isHub: computed('hubCommunity.orgId', 'isUmbrella', 'session.portal', function () {
+  }
+
+  @computed('hubCommunity.orgId', 'isUmbrella', 'session.portal')
+  get isHub() {
     const isHub = !!this.get('hubCommunity.orgId') && !this.isUmbrella;
     return isHub;

If I change that to:

  get isHub () {
    return false;
  }

Then when the tests re-run it throws a similar error for a different CP on a different service.

Seems to come from https://github.com/emberjs/ember.js/blob/v3.16.6/packages/@ember/-internals/metal/lib/computed.ts#L615

Any ideas?

tomwayson avatar Apr 23 '20 03:04 tomwayson

Any updates on this, cause I am facing a similar issue.

jayeshgiramkar avatar Oct 18 '21 08:10 jayeshgiramkar

Curious if anyone found a solution to this - I'm having similar problems when manually converting some things to native classes (don't think it's just the codemod that causes the problem).

richgt avatar Sep 27 '22 21:09 richgt