littensy/pretty-react-hooks

Bug with package if it used by the plugin

Closed this issue · 1 comments

I was making a plugin using React and I found a problem: if you reload the plugin (during an update or just disable/enable) the React breaks
After some digging, I found that the problem is _G.ROACT_17_MOCK_SCHEDULER.
if that variable is not nil, react will not render the root

that can be a problem for the plugins using React, if ROACT_17_MOCK_SCHEDULER is not nil they will not be able to render the plugin GUI.
the only file that sets it is testez
out -> utils -> testez
image

Is it possible to delay requiring that script or at least setting this flag when some of its components are used?

something like

let initialized = false

function checkInitialization(){
 if(initialized) return;
 initialized = true;
 _G.__ROACT_17_MOCK_SCHEDULER__ = true;
}

function ...Hook(){
checkInitialization()
 ...
}

Resolved in c5e214e