marko: Top-level "if" statement in marko template yields unhelpful error

Bug Report

Marko Version: 4.5.6

Details

I tried to create a component like

<if(input.flash)>
  <div class=`alert ${input.flash.type}`>
    ${input.flash.message}
  </div>
</if>

without wrapping it in a div.

Expected Behavior

An error like ERROR at filename.marko:1 : Marko directives must have an enclosing tag.

Actual Behavior

Uncaught TypeError: Cannot read property '___markoDetached' of null

Your Environment

  • Environment name and version: Chrome Version 61.0.3163.100 (Official Build) (64-bit), Node 8.6.0
  • Operating System and version: MacOS

Steps to Reproduce

  1. create a component with <if> as the top-level tag
  2. compile (should happen successfully)
  3. attempt to run in browser

Stack Trace

Uncaught TypeError: Cannot read property '___markoDetached' of null
    at morphComponent (VM28552 index.js:154)
    at morphChildren (VM28552 index.js:223)
    at morphComponent (VM28552 index.js:124)
    at morphChildren (VM28552 index.js:248)
    at morphdom (VM28552 index.js:517)
    at VM28553 Component.js:475
    at Object.batchUpdate [as ___batchUpdate] (VM28550 update-manager.js:63)
    at Component.___rerender (VM28553 Component.js:458)
    at initComponent (VM28556 init-components-browser.js:103)
    at VM28556 init-components-browser.js:261

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 16 (6 by maintainers)

Commits related to this issue

Most upvoted comments

Yeah I’ve been totally unable to reproduce this in a toy project. Maybe I’ll try making a “minimal” version of my existing app, where I’m hitting the problem.