ember.js icon indicating copy to clipboard operation
ember.js copied to clipboard

`each` with an `undefined` element and `key` blows up

Open boris-petrov opened this issue 1 year ago • 3 comments

🐞 Describe the Bug

See the reproduction below.

🔬 Minimal Reproduction

{{#each (array undefined) key="anything"}}{{/each}}

😕 Actual Behavior

Exception:

Uncaught (in promise) Error: boundsList cannot be empty
    at debugAssert (ember.js:511:1)
    at LiveBlockList.finalize (ember.js:6350:1)
    at NewElementBuilder.popBlock (ember.js:6329:1)
    at VM.execute (ember.js:6711:1)
    at TryOpcode.handleException (ember.js:6669:1)
    at UpdatingVMFrame.handleException (ember.js:6687:1)
    at UpdatingVM.throw (ember.js:6668:1)
    at Assert.evaluate (ember.js:6358:1)
    at UpdatingVM._execute (ember.js:6668:1)
    at ember.js:6665:1
    at debug$1.runInTrackingTransaction (ember.js:1360:1)
    at UpdatingVM.execute (ember.js:6665:1)
    at RenderResultImpl.rerender (ember.js:6687:1)
    at ember.js:14367:1
    at RootState.render (ember.js:14363:1)
    at ember.js:14398:1
    at inTransaction (ember.js:6494:1)
    at Renderer._renderRoots (ember.js:14391:1)
    at Renderer._renderRootsTransaction (ember.js:14403:1)
    at Renderer._revalidate (ember.js:14405:1)
    at invoke (ember.js:3200:1)
    at Queue.flush (ember.js:3195:1)
    at DeferredActionQueues.flush (ember.js:3214:1)
    at Backburner._end (ember.js:3244:1)
    at Backburner._boundAutorunEnd (ember.js:3221:1)

🤔 Expected Behavior

No error.

🌍 Environment

  • Ember: 5.12.0
  • Ember-CLI: 5.12.0
  • Node.js/npm: v23.1.0
  • OS: Linux
  • Browser: N/A

boris-petrov avatar Oct 30 '24 16:10 boris-petrov

Hello @boris-petrov, can i work on this , since this is my first contribution

Mudavath-Giri-Naik avatar Nov 07 '24 19:11 Mudavath-Giri-Naik

I couldn't reproduce this in glimmer-vm, so I think it's a bug here: https://github.com/emberjs/ember.js/blob/main/packages/%40ember/template-compiler/lib/plugins/transform-each-track-array.ts#L26

NullVoxPopuli avatar Nov 13 '24 22:11 NullVoxPopuli

It turns out that if the test is done in ember, it does reproduce!!

I can have a go at fixing this once the repo merge is done 🎉

NullVoxPopuli avatar Dec 09 '25 21:12 NullVoxPopuli