Skip to content

fix: inject dev tools only once#366

Closed
dennemark wants to merge 1 commit into
brianzinn:masterfrom
dennemark:fixInjectDevToolsOnce
Closed

fix: inject dev tools only once#366
dennemark wants to merge 1 commit into
brianzinn:masterfrom
dennemark:fixInjectDevToolsOnce

Conversation

@dennemark

@dennemark dennemark commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

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

@dennemark dennemark marked this pull request as draft July 1, 2026 12:27
@dennemark

Copy link
Copy Markdown
Contributor Author

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...

@dennemark dennemark closed this Jul 1, 2026
@brianzinn

Copy link
Copy Markdown
Owner

#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.

@dennemark

Copy link
Copy Markdown
Contributor Author

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.
Since the other code is rather for react 18 and from 2024 you can probably also close that one...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants