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

Weird issue when referencing document in callback of will-destroy #4

Open
cibernox opened this issue Feb 2, 2019 · 2 comments
Open

Comments

@cibernox
Copy link

cibernox commented Feb 2, 2019

I'm not sure how/if this is really related to the modifiers, but I haven't been able to reproduce it without them. I believe it's some kind of interaction between babel/decorators/modifiers.

Apparently if in the callback passed to {{will-destroy}} I use the global document without having referenced it elsewhere, the compilation blows badly:

ReferenceError: document is not defined
    at BasicDropdownTrigger.removeGlobalHandlers (/var/folders/bt/62lj_mr106zbk82m8kl772b00000gn/T/broccoli-9932Xc3l4ZKiotlD/out-271-broccoli_merge_trees/assets/addon-tree-output/ember-basic-dropdown/components/basic-dropdown-trigger.js:140:1)
    at Object.destroyModifier (/var/folders/bt/62lj_mr106zbk82m8kl772b00000gn/T/broccoli-9932Xc3l4ZKiotlD/out-271-broccoli_merge_trees/assets/addon-tree-output/@ember/render-modifiers/modifiers/will-destroy.js:26:1)
    at CustomModifierState.destroy (/var/folders/bt/62lj_mr106zbk82m8kl772b00000gn/T/broccoli-9932Xc3l4ZKiotlD/out-271-broccoli_merge_trees/assets/vendor/ember-modifier-manager-polyfill.js:58:1)
    at SimpleBlockTracker.destroy (/var/folders/bt/62lj_mr106zbk82m8kl772b00000gn/T/broccoli-9932Xc3l4ZKiotlD/out-271-broccoli_merge_trees/assets/@glimmer/runtime.js:2411:1)
    at UpdatableBlockTracker.destroy (/var/folders/bt/62lj_mr106zbk82m8kl772b00000gn/T/broccoli-9932Xc3l4ZKiotlD/out-271-broccoli_merge_trees/assets/@glimmer/runtime.js:2411:1)

The reproduction can be this PR: cibernox/ember-basic-dropdown#449

If (this line)[https://github.com/cibernox/ember-basic-dropdown/pull/449/files#diff-e8b1232b23cd9aba9a4b4c3f74b118fcR18] referencing the global document is removed the code fails to compile.

@rwjblue
Copy link
Member

rwjblue commented Feb 2, 2019

WAT

@rwjblue
Copy link
Member

rwjblue commented Feb 2, 2019

This seems really strange.

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