-
Notifications
You must be signed in to change notification settings - Fork 932
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash when using React 16.4.1 #555
Comments
As a temporary workaround for folks, you can add the following shim to the beginning of your configuration scripts: https://gist.github.com/ChadBurggraf/4c4abef515852aa1efee04478a8a8641 |
I ran out of time to investigate this today, I'll pick it up again in a few days if someone doesn't get to it first. I wanted to repro the issue with the |
setTimeout and clearTimeout may not be available in some server-render environments (such as ChakraCore in React.NET), and loading ReactScheduler.js will cause a crash unless the existence of the variables are checked via a typeof comparison. reactjs/React.NET#555
setTimeout and clearTimeout may not be available in some server-render environments (such as ChakraCore in React.NET), and loading ReactScheduler.js will cause a crash unless the existence of the variables are checked via a typeof comparison. reactjs/React.NET#555 The crash did not occur in 16.4.0, and the change appears to have been introduced here: https://github.com/facebook/react/pull/12931/files#diff-bbebc3357e1fb99ab13ad796e04b69a6L47 I tested this by using yarn link and running it with a local copy of React.NET. I am unsure the best way to unit test this change, since assigning null to `setTimeout` causes an immediate crash within the Node REPL.
setTimeout and clearTimeout may not be available in some server-render environments (such as ChakraCore in React.NET), and loading ReactScheduler.js will cause a crash unless the existence of the variables are checked via a typeof comparison. reactjs/React.NET#555 The crash did not occur in 16.4.0, and the change appears to have been introduced here: https://github.com/facebook/react/pull/12931/files#diff-bbebc3357e1fb99ab13ad796e04b69a6L47 I tested this by using yarn link and running it with a local copy of React.NET. I am unsure the best way to unit test this change, since assigning null to `setTimeout` causes an immediate crash within the Node REPL.
* Fix crash during server render. setTimeout and clearTimeout may not be available in some server-render environments (such as ChakraCore in React.NET), and loading ReactScheduler.js will cause a crash unless the existence of the variables are checked via a typeof comparison. reactjs/React.NET#555 The crash did not occur in 16.4.0, and the change appears to have been introduced here: https://github.com/facebook/react/pull/12931/files#diff-bbebc3357e1fb99ab13ad796e04b69a6L47 I tested this by using yarn link and running it with a local copy of React.NET. I am unsure the best way to unit test this change, since assigning null to `setTimeout` causes an immediate crash within the Node REPL. * Fix flow errors and log warning if setTimeout / clearTimeout are not defined / not a function. * Use invariant to assert setTimeout / clearTimeout are functions * Remove use of invariant * Explain
@ChadBurggraf Where in the code do you add that? I am seeing this error since adding Video.js via npm. |
@dustinsoftware When will the changes that were merged be released via Nuget? Or do i have to build from source now? |
You need to pin to 16.4.0 or add the shim to your scripts. I’ll work on
adding a shim to the library itself but it might take a few days for me to
get to it. The patch to react itself was merged but won’t be available
until the next release.
Dustin
…On Sat, Jun 23, 2018 at 19:42, John Bell ***@***.***> wrote:
@dustinsoftware <https://github.com/dustinsoftware> When will this be
released via Nuget? Or do i have to build from source now?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#555 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA5hFnk-aAySoHTUcaAytMc_YxO-9odzks5t_vylgaJpZM4Uumti>
.
|
@dustinsoftware Awesome. Thank you for the response. So i've downgraded React and React-Dom to 16.4.0 but still seeing the error.
The version number inside of react.development.js is 16.4.0 and same with react-dom.development.js Still seeing the timeout issue. Does Webpack or the JsEngineSwitcher affect this? |
@Neuroforge do you only see this error when adding Video.js? Are you bundling react with webpack or using the built in react version? |
I will try using another js library with timeout. Any ideas on a good one to try? I am using Webpack and ChakraCore js engine. |
In some cases, React (or other libraries) will assume that setTimeout and clearTimeout are defined on the global scope, without invoking it. We should still throw an error in case a consumer expects this to just work on the server (it won't), but we can avoid a crash by defining the function on the global scope. For context: reactjs#555
In some cases, React (or other libraries) will assume that setTimeout and clearTimeout are defined on the global scope, without invoking it. We should still throw an error in case a consumer expects this to just work on the server (it won't), but we can avoid a crash by defining the function on the global scope. For context: #555
In some cases, React (or other libraries) will assume that setTimeout and clearTimeout are defined on the global scope, without invoking it. We should still throw an error in case a consumer expects this to just work on the server (it won't), but we can avoid a crash by defining the function on the global scope. For context: #555
In some cases, React (or other libraries) will assume that setTimeout and clearTimeout are defined on the global scope, without invoking it. We should still throw an error in case a consumer expects this to just work on the server (it won't), but we can avoid a crash by defining the function on the global scope. For context: reactjs/React.NET#555
In some cases, React (or other libraries) will assume that setTimeout and clearTimeout are defined on the global scope, without invoking it. We should still throw an error in case a consumer expects this to just work on the server (it won't), but we can avoid a crash by defining the function on the global scope. For context: reactjs/React.NET#555
In some cases, React (or other libraries) will assume that setTimeout and clearTimeout are defined on the global scope, without invoking it. We should still throw an error in case a consumer expects this to just work on the server (it won't), but we can avoid a crash by defining the function on the global scope. For context: reactjs/React.NET#555
While investigating #554, I discovered that React.NET totally breaks when using
react
andreact-dom
16.4.1, but 16.4.0 seems to be unaffected, so users can pin to that version until we ship a fix.Unfortunately the crash is obscured by a check that looks for React on the global scope. To see the real exception, patch
ReactNET_initReact
to always returntrue
inshims.js
. I'll open up a separate issue to investigate whether we still need to have that method around (we'd just crash at runtime if one of the globals was missing, right?)Anyhow. The real crash is
ReactScriptLoadException: Error while loading "~/components-bundle.generated.js": ReferenceError: 'setTimeout' is not defined
Which corresponds to
SelectEventPlugin
:The regression appears to be introduced by this change: https://github.com/facebook/react/pull/12931/files#diff-bbebc3357e1fb99ab13ad796e04b69a6L47
I'll open an issue tomorrow and investigate a fix. cc @Daniel15
The text was updated successfully, but these errors were encountered: