This project is archived and is in readonly mode.
UJS & partial possible bug
-
Marjan Krekoten'
Well I maybe wrong but your code just enters infinite loop.
_list_add.html.erband_list_new.html.erbrender each other until ruby crashes. -
Philippe Lang
- Tag changed from illegal response, partial, ujs to illegal instruction, partial, ujs
Hi Marjan,
Each partial renders the other, but only after a click, since "link_to_function" is used. This shouldn't be a problem as far as I understand. But you are right, there must be some kind of infinite loop inside the framework.
-
Marjan Krekoten'
It renders partials on server side. JS code on clients side operates with already rendered strings. So while rendering those partials are trying to render each other.
-
Philippe Lang
When rendering list.html.erb, I thought that only the _list_add.html.erb partial was rendered, with a link allowing the rendering of the next partial through UJS, and so on. Conceptually, I have to admit I still don't see exactly why this code breaks...
-
Philippe Lang
Hum, I think I understand better now. As you say "JS code on clients side operates with already rendered strings". That means rails tries to pre-render both partials rendering each other, UJS or not, resulting in an infinite loop. I could see that with a few puts added at the top of the partials:
------> rendering new ------> rendering add ------> rendering new ------> rendering add ------> rendering new ------> rendering add ------> rendering new ------> rendering add ------> rendering new ------> rendering add ------> rendering new ------> rendering add ------> rendering new ------> rendering add ------> rendering new ------> rendering add ------> rendering new ------> rendering add ------> rendering new Illegal instructionSo I guess this is not a bug at all: rails certainly works like this "by design".