Skip to content

Conversation

@jembezmamy
Copy link
Contributor

We've got some cases when Ember App is destroyed, but React component still tries to access an Ember service. This results in an error:

Error: Cannot call `.lookup('service:organization-manager')` after the owner has been destroyed
    at Container.lookup (http://localhost:7357/assets/vendor.js:575:15)
    at ApplicationInstance.lookup (http://localhost:7357/assets/vendor.js:10272:33)
    at useEmberService (http://localhost:7357/assets/chunk.b17651e957f6f92a7c28.js:6328:16)
    at useOrganizationManager (http://localhost:7357/assets/chunk.20e8505b24b143d532a8.js:6423:101)
    at useFetchForwardingEmail (http://localhost:7357/assets/chunk.20edc446a6268cec6b84.js:14706:105)
    at CopyEmailButton (http://localhost:7357/assets/chunk.20edc446a6268cec6b84.js:333:125)
    at renderWithHooks (http://localhost:7357/assets/chunk.b17651e957f6f92a7c28.js:97930:157)
    at updateFunctionComponent (http://localhost:7357/assets/chunk.b17651e957f6f92a7c28.js:98502:388)
    at beginWork (http://localhost:7357/assets/chunk.b17651e957f6f92a7c28.js:98910:549)
    at beginWork$1 (http://localhost:7357/assets/chunk.b17651e957f6f92a7c28.js:99966:93)

To prevent that, we should remove all Application Context children once the owner is destroyed.

Copy link

@uanjoze uanjoze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙏

@jembezmamy
Copy link
Contributor Author

This approach is useful for debugging, it allows us to identify which component was not unmounted correctly. It might be useful in the future, but since the original issue is already fixed, let's close this PR.

@jembezmamy jembezmamy closed this Oct 3, 2025
@jembezmamy jembezmamy deleted the fix-destroyed-owner branch October 3, 2025 07:26
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

Successfully merging this pull request may close these issues.

2 participants