fix: inject dev tools only once#366
Conversation
|
Closing this. The OOM is happening through injectDevTools, but it is an issue i need to solve in my app, because of cyclicle objects of tanstack table rows. It is not solved by this PR. If the singleton pattern is still helpful, this PR can be reopend though... |
|
#308 is a PR that I couldn't repro. I'm happy to merge in both, but I maybe unnecessarily wanted to repro. The singleton would at least keep the memory stack once - instead of recreating. That's going to cause a lot of memory pressure. Let me know - happy to merge if there are no other side-effects. |
|
Tbh. since this issue was not directly related to my main issue, i cannot tell if it fixes any issue. At least it is nothing I could reproduce. I wanted to fix my issue in react-babylonjs, but when applying it in my app repository i forgot to remove the other workaround, so it looked like it fixed my issue. Only then i realised i had to remove my old code and therefore this code was unnecessary. |
Hi,
I use react dev tools and in some rare case it would try to recreate the inject dev tools again and again, partly running into OOM.
The PR therefore creates a singleton for react-babylonjs.
I do not have a reproduction for this - in our app we used tanstack-table with rows that have cyclical references and somehow it might have been connected with them, when there were a lot of rows.
EDIT: The issue in my repository still persists, since i still had other code that would bypass the cyclical issue. going to investigate further.
A patched version in my repository works.This might possibly also close this PR which still deals with some similar issue for react 18: https://github.com/brianzinn/react-babylonjs/pull/308/changes