Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InfinityLoader.willDestroy incorrectly assumes inifinityModel is still valid #485

Open
trevordevore opened this issue Sep 3, 2024 · 1 comment

Comments

@trevordevore
Copy link
Contributor

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
9b6956b 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.

@trevordevore
Copy link
Contributor Author

I've created a PR with a suggested change that fixes the bug in my application. Since _loadStatusDidChange has an early exit if isDestroying or isDestroyed this seemed like a safe approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant