[Bug] Hash helper dynamically constructs new object each time it is accessed from let helper
- Dominant language
- TypeScript
- Stars
- 22.6k
- Forks
- 4.2k
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 15
Description
### 🐞 Describe the Bug
When using the `hash` helper in a template, the result of that helper does not appear to get reused in all situations where it is consumed. In the flow of the template, we appear to call the `hash` helper once and then there appears to be lazy access to the hash helper each time its result is used. This results in the hash being recreated rather than using the same hash.
### 🔬 Minimal Reproduction
I tested this issue using Ember's `guidFor` to try different patterns and see if `guidFor` consistently returned the same guid as expected:
https://ember-twiddle.com/93e426e0696a9ce7a3f20b2a0ceecfbe?openFiles=templates.application%5C.hbs%2Ctemplates.components.double-conditional-yield%5C.hbs
### 😕 Actual Behavior
As you can see in the reproduction, there are several cases where the result of the `hash` helper changes further down the DOM tree, even though the flow of the template dictated just a single call to it.
### 🤔 Expected Behavior
`guidFor` should be able to return the same result for any object generated by a single call to the `hash` helper
### 🌍 Environment
- Ember: 3.18
- Node.js/npm: 12
- OS: MacOS
- Browser: Chrome
### ➕ Additional Context
I believe this issues with the `hash` helper extends beyond just its use in combination with the `let` helper, but I have not yet been able to reproduce the exact sequence in a Twiddle.
Contributor guide
Assessment
This issue has not been assessed yet.