adopted-ember-addons / adopted-ember-addons/ember-infinity

InfinityLoader.willDestroy incorrectly assumes `inifinityModel` is still valid

Open
#485 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
374
Forks
128
PR merge metrics
No merged PRs in 30d

Description

After updating to ember-infinity 3.0.0 I'm seeing the following error when transitioning to a new route:

```
global failure: TypeError: Cannot read properties of undefined (reading 'off')
Source:
TypeError: Cannot read properties of undefined (reading 'off')
```

The error occurs in `addon/components/infinity-loader.js#willDestroy` because `infinityModel` is `null`. I see that in commit
https://github.com/adopted-ember-addons/ember-infinity/commit/9b6956b6714fd5fd156183652fa7efd646eddbd4 the check for `isDestroyed` was added because of the same error after a route change.

The difference in my situation is that `isDestroyed` is `false` BUT `isDestroying` is `true`. In my case the `infinityModel` has already been nullified at this point.

### Context

The application is running Ember 3.28 and is being prepared for an upgraded to 4. I tested the same code with Ember 4.0.1 but got the same result.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.