Calling Render.create when engine.pairs is populated throws Maximum call stack size exceeded
See this pen.
If pairs are evident on the Engine instance, Render.create hits infinite recursion inside Common.Extend due to body.parent === body circular reference for body.id === 1.
Adding a Pairs.clear(engine.pairs) is a workaround for this issue as can also be seen in the pen.
Looks like a bug, thanks. For now I assume you don't actually need to call Engine.update that early, so you can avoid this?
In that minimal example sure. In my actual project I use that renderer for debug purposes, and it can be instantiated at any time, including after the engine has been instantiated/updated, so i'm using the Pairs.clear workaround for now.
Just some updates in case anyone is googling (I came across this one again just now).
When this occurs;
- Chrome (v55) will just crash without showing any error, with the "Aw, snap" screen.
- Microsoft Edge (v38) will throw the error "Out of stack space" linking to this line.
This seems to be related to #241. I guess I need to re-think the way that Common.extend works, or potentially even stop using it in create functions.
I have this issue too. In my case I destroyed the canvas containing the render so i'm trying to create a new one and that happens
I also hit this. I only need the rendered view when debugging so I'm trying to dynamically display/hide the rendering.
Running Render.create results in

Any workarounds at the moment?
I'm currently creating a dedicated element for the renderer regardless if I need to show the rendering, and dynamically append it to DOM and start rendering when I need it and stop the rendering and remove it from DOM when I'm done with it. The reference to the dedicated element sticks around.
@Zodiase did you have any luck with the earlier suggested workaround using Pairs.clear(engine.pairs)?