Weird issue when referencing `document` in callback of will-destroy
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- babel, typescript
- Domain
- build-system, frontend
Research direction
Start with the reproduction in ember-basic-dropdown PR #449 and compare the build with and without the global document reference in the will-destroy callback. Trace the failure through the will-destroy modifier and the generated component code; done means the reproduction compiles and the callback no longer throws ReferenceError: document is not defined.
Written by the indexing model from the issue text.
Description
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: https://github.com/cibernox/ember-basic-dropdown/pull/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.
- Dominant language
- TypeScript
- Stars
- 86
- Forks
- 34
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from emberjs/ember-render-modifiers
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
emberjs/ember-render-modifiers#38 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
emberjs/ember-render-modifiers#23 · 2 comments · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
emberjs/ember-render-modifiers#21 · 3 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 38/100
emberjs/ember-render-modifiers#20 · 4 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
emberjs/ember-render-modifiers#18 · 5 comments ·
All issues in emberjs/ember-render-modifiers
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
copse-dev/agent-pane#2953 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·