Raynos / mercury

A truly modular frontend framework
http://raynos.github.io/mercury/
MIT License
2.82k stars 143 forks source link

14.1.0 break all VNode input rendering #201

Closed mikeangstadt closed 8 years ago

mikeangstadt commented 8 years ago

Any VNode which takes a nested VNode (which was valid in 14.0.0) as an input now breaks in 14.1.0

js fails on: "Expected VNodeTree | VNode | string but got: "

when "got" is valid VNode.

gcallaghan commented 8 years ago

Can you submit an example?

mikeangstadt commented 8 years ago

Sure, the below is an example of an img tag passed as a child of an a tag.

h('a', { href:'/some-page.php'}, [
    h('img', {
       alt:'Our company logo', 
       src: 'https://www.our_company_website.com/logo.png'
    })
]);

renders this error in 14.1.0 (not 14.0.0)

Expected a VNode / Vthunk / VWidget / string but:
got:
{
    "tagName": "IMG",
    "properties": {
        "alt": "Our company logo",
        "src": "https://www.our_company_website.com/logo.png"
    },
    "children": [],
    "namespace": null,
    "count": 0,
    "hasWidgets": false,
    "hasThunks": false,
    "descendantHooks": false
}.
The parent vnode is:
{
    "tagName": "A",
    "properties": {
        "href": "/some-page.php"
    }
}
gcallaghan commented 8 years ago

and just to double check, is the fact that the img tag is not quoted a typo?

h(img, {
mikeangstadt commented 8 years ago

yes, sorry - updated.

gcallaghan commented 8 years ago

I am unable to reproduce. I attempted to verify using the following patch:

diff --git a/examples/todomvc/todo-app.js b/examples/todomvc/todo-app.js
index 8101aea..6d2a369 100644
--- a/examples/todomvc/todo-app.js
+++ b/examples/todomvc/todo-app.js
@@ -182,6 +182,12 @@ function infoFooter() {
         h('p', [
             'Part of ',
             h('a', { href: 'http://todomvc.com' }, 'TodoMVC')
+        ]),
+        h('a', { href:'http://google.com'}, [
+            h('img', {
+               alt:'Our company logo',
+               src: 'https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png'
+            })
         ])
     ]);
 }

14.1 updates virtual-dom. Is your project referencing an older version?

mikeangstadt commented 8 years ago

Yes, that is it. we're using in other module virtual-dom:1.3.0

Thanks for the help!

On Wed, Feb 3, 2016 at 12:32 PM, Grant Callaghan notifications@github.com wrote:

I am unable to reproduce. I attempted to verify using the following patch:

diff --git a/examples/todomvc/todo-app.js b/examples/todomvc/todo-app.js index 8101aea..6d2a369 100644 --- a/examples/todomvc/todo-app.js +++ b/examples/todomvc/todo-app.js @@ -182,6 +182,12 @@ function infoFooter() { h('p', [ 'Part of ', h('a', { href: 'http://todomvc.com' }, 'TodoMVC')

14.1 updates virtual-dom. Is your project referencing an older version?

— Reply to this email directly or view it on GitHub https://github.com/Raynos/mercury/issues/201#issuecomment-179393026.

Mike Angstadt www.mikeangstadt.com @mike_angstadt http://www.twitter.com/mike_angstadt | LinkedIn http://www.linkedin.com/in/mikeangstadt 610-914-4409

"The noblest pleasure is the joy of understanding" - Leonardo Di Vinci

gcallaghan commented 8 years ago

Excellent! do you mind closing the issue then?

panthershark commented 8 years ago

Quick note on this issue. It looks like mercury 14.1.0 should have been a major bump to 15.0.0. The vdom upgrade makes mercury 14.0.0 incompatible with 14.1.0.