Closed bananarne closed 8 years ago
I haven't figured it out yet, but when helping someone else running on 0.10.2 I could see the reloader thinks it's evaluating the code, but the react components were not redrawing, switching back to 0.9 made it work. I should note that there were a number issues with 0.10 and reactrb, so the problem may lie there
I think i figured it out, but i've never worked with github so far, but i will try to make a pull request if i was right.
In case somebody needs information, when eval-ing in <opal-0.10 the code gets evaluated on "top-level" namespace and this behaviour was wrong (and you've used it that way). Opal fixed that behaviour in 0.10 and as soon as you eval code inside a namespace any generated objects will be inside that namespace.
The correct way to fix this would be to use the second parameter of eval, which is the binding to a scope. Unfortunately this does not exist in opal-0.10. So you would have to do something like eval_proc = { |s| eval s } in the main object and call it on the reload event.
tl;dr eval was broken, is now fixed but is missing the second parameter, dirty workaround needed
Thanks for the info and the PR!
merged PR, closing, tested against a 0.10.2 and a 0.9.4 reactrb project
What exactly is the Issue with opal versions above 0.9? Is it that eval works correctly in terms of namespace, creating the objects inside the namespace of opal-hot-reloader?