marko-js / marko

A declarative, HTML-based language that makes building web apps fun
https://markojs.com/
MIT License
13.25k stars 643 forks source link

Named body content without ".renderBody" broken in marko >= 4.18.36 #1501

Closed MuwuM closed 2 years ago

MuwuM commented 4 years ago

Marko Version: 4.18.36

still broken in 4.18.46

Details

In your documentation you write:

ProTip: The renderBody property can be omitted. You could use <${input.heading}/>, for example.

Expected Behavior

When I do this it works fine in marko <= 4.18.35

Actual Behavior

but fails with error "Invalid dynamic tag value" in marko >= 4.18.36

Workaround

appending .renderBody fixes this error in marko >= 4.18.36 <= 4.18.46

Additional Info ### Your Environment - Tested with Firefox 73.0 (browser) and node.js 12.16 (backend) using koa 2.11.0 (framework) - Windows desktop client, alpine linux server ### Steps to Reproduce 1. follow [https://markojs.com/docs/body-content/#named-body-content](https://markojs.com/docs/body-content/#named-body-content) 2. remove the `.renderBody` as mentioned in the ProTip ### Stack Trace ``` Error: Error: Invalid dynamic tag value 3 index-8f34d635.js:83:19 emit /static/pages-all/events-light$1.0.5/src/index-8f34d635.js:83 Marko 15 emit error dynamicTag render forOf render renderer ___rerender ___scheduleRerender batchUpdate ___scheduleRerender update updateComponents updateUnbatchedComponents ``` ### Further investigation The error is probably thrown beause this if fails: [link](https://github.com/marko-js/marko/blob/03392555269208f588dc1e2e848b739a481f2bc2/src/runtime/helpers/dynamic-tag.js#L110) so maybe it helps to also check wheter the renderer has a `.renderBody ` property if it is not a function. But I cannot make sure whether this would be the only place that would need to be modified for a proper solution. Also it seems to render fine on Server-Side, but fails client side (probably already during hydration)
DylanPiercey commented 2 years ago

I'm not able to reproduce this myself. If we can get a reduced test case with it broken that would be helpful!