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

[Bug] destroyModifier triggers ember-data:method-calls-on-destroyed-store #19447

Open
wongpeiyi opened this issue Mar 4, 2021 · 2 comments
Open

Comments

@wongpeiyi
Copy link

wongpeiyi commented Mar 4, 2021

🐞 Describe the Bug

Upon acceptance test completion, modifier destroy on app teardown results in ember-data:method-calls-on-destroyed-store warning if the modifier args is a RecordArray

This happens from 3.22 onwards. I believe this happens because teardown results in the modifier calling registerDestructor(state, () => delegate.destroyModifier(instance, state.args)); but the args then accesses the store when store.isDestroying

Not sure if its more an ember data issue and should be posted there instead.

Perhaps related to #19162 ?

🔬 Minimal Reproduction

Might be totally off in my understanding of what's happening, so I came up with a minimal reproduction here: https://github.com/wongpeiyi/modifier-destroy

😕 Actual Behavior

Acceptance test results in deprecation warnings:

DEPRECATION: Attempted to call store.adapterFor(), but the store instance has already been destroyed. [deprecation id: ember-data:method-calls-on-destroyed-store]
        at logDeprecationStackTrace (http://localhost:7358/assets/vendor.js:36451:21)
        at HANDLERS.<computed> (http://localhost:7358/assets/vendor.js:36548:9)
        at raiseOnDeprecation (http://localhost:7358/assets/vendor.js:36478:9)
        at HANDLERS.<computed> (http://localhost:7358/assets/vendor.js:36548:9)
        at invoke (http://localhost:7358/assets/vendor.js:36560:9)
        at Object.deprecate (http://localhost:7358/assets/vendor.js:36516:28)
        at assertDestroyedStore (http://localhost:7358/assets/vendor.js:89833:66)
        at Store.adapterFor (http://localhost:7358/assets/vendor.js:89432:9)
        at Store._findHasManyByJsonApiResource (http://localhost:7358/assets/vendor.js:88143:26)

DEPRECATION: Attempted to call store.findMany(), but the store instance has already been destroyed. [deprecation id: ember-data:method-calls-on-destroyed-store]
        at logDeprecationStackTrace (http://localhost:7358/assets/vendor.js:33734:21)
        at HANDLERS.<computed> (http://localhost:7358/assets/vendor.js:33867:9)
        at raiseOnDeprecation (http://localhost:7358/assets/vendor.js:33761:9)
        at HANDLERS.<computed> (http://localhost:7358/assets/vendor.js:33867:9)
        at invoke (http://localhost:7358/assets/vendor.js:33879:9)
        at Object.deprecate (http://localhost:7358/assets/vendor.js:33835:28)
        at assertDestroyedStore (http://localhost:7358/assets/vendor.js:89633:66)
        at Store.findMany (http://localhost:7358/assets/vendor.js:87901:9)
        at Store._findHasManyByJsonApiResource (http://localhost:7358/assets/vendor.js:87965:21)

🤔 Expected Behavior

Warnings shouldn't be shown. Modifier shouldn't recompute args on destroy?

🌍 Environment

  • Ember: 3.22 - 3.25
@boris-petrov
Copy link
Contributor

This is perhaps fixed by glimmerjs/glimmer-vm#1276?

@wongpeiyi
Copy link
Author

That looks promising, thank you

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

2 participants