hexops / vecty

Vecty lets you build responsive and dynamic web frontends in Go using WebAssembly, competing with modern web frameworks like React & VueJS.
BSD 3-Clause "New" or "Revised" License
2.79k stars 144 forks source link

dom: should documente more breaking changes since the old version #259

Open scbizu opened 4 years ago

scbizu commented 4 years ago

Hi there ! we start to use vecty in our internal projects last year , it was all fine until today we recompile our Go code , it panics after converted into the JavaScript code .

With the the long time debugging, I finally fixed it and I think it should be reported to the vecty community .

Here is the story

Here is our index.html looks like:

<!DOCTYPE html>
<!-- some js resources-->
<html>
   <head>
  </head>
</html>

It works before the RenderInto merged into the master . But now it will occur the panic because of the missing of <body></body> tag . And I think vecty not treat this kind of panic gracefully , the renderIntoNode will accept the nil jsObject if the origin object is js's null (https://github.com/gopherjs/vecty/blob/master/dom_wasmjs_gopherjs.go#L76) , and also the !node.Truthy() can not resolve this kind of null objects and then it panics at https://github.com/gopherjs/vecty/blob/master/dom.go#L1219 .

Everything is OK after I add the body tag to my index.html and put the js resource file at the bottom of my HTML file.

Proposal