-
Notifications
You must be signed in to change notification settings - Fork 801
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
AppContainer is using ReactNoopUpdateQueue in dev builds, preventing React component state updates #593
Comments
Actually sorry, I don't think the initialisation of I should be looking at the same callstack except for when my own |
I'll close this for now because I don't think it's a react-hot-loader issue. |
@TAGC I'm encountering the same error with
My component is confirmed mounted (it would be impossible at the root to encounter this situation). I have meticulously compared to
I think this is a bug. I can file another issue, or you could reopen this one. |
Possibly related to #313 My {
"sourceMaps": "inline",
"presets": [
[
"env",
{
"targets": {
"browsers": "> 5%"
},
"modules": false,
"debug": true
}
],
"stage-2",
"react"
],
"plugins": [
"react-hot-loader/babel",
["relay", {"compat": true, "schema": "./schema.json"}],
"transform-flow-strip-types",
["lodash", { "id": ["lodash", "recompose"] }]
]
} |
I'm also experiencing this issue, using beta 7. I don't have my project handy at the moment to rattle off version numbers, but they're likely similar to the others in this thread. I just wanted to reply to add to the list of folks experiencing the issue. Edit: It's definitely something related to react hot loader. I tried using specific, older versions of the beta and the error exists at all versions. If I remove react hot loader entirely everything works as expected. After looking at some of the release notes related to the beta releases, react hot loader appears to do a lot of things related to babel transforms and class properties, etc. There's just most likely some clash between what react hot loader is applying and what babel intends, or what react expects, etc. |
Worked around this issue as I commented in facebook/react#10012. |
I have tried all workarounds in linked issues with no success, including adding Using the |
I fixed it with add |
Running into the same issue in our code. Have a simple input field for a zip code with an event handler like so: handleChange = (value) => {
if (!this.state.zipChanged) {
this.setState({ zipChanged: true });
}
} Removing 'react-hot-loader/babel' from the babel loader fixes the issue, but breaks hot reloading. We are using the react, env, stage-2 presets, and transform-decorators-legacy plugin with the babel (v 6.24.1) loader. Env gives us: I have created a simpler project that reproduces this issue here: https://github.com/bspies-work/react-hot-load |
My temporary solution has been to remove |
I faced the same error, what a headache. I finally solved this, replacing the "stage-2" preset by "latest" in the babel.rc file. (Maybe someone can explain why this solve the problem !?) Before (bug) :
After:
|
@fabriceci Likely because "latest" (which is no longer recommended, in favor of the "env" preset) includes |
@noinkling thanks for you answer. I changed my presets to :
I notice "Transform-es2015-classe" is included by the "env preset" only if it fits the browser's target config. With my config above, I'm forced to add the plugin manually. But, for exemple, if you target IE11, the plugin will be applied by the "env preset" automatically (so no need to add it manually).
It seems illogical to have to add the plugin if the env preset said you don't need it. |
I am not transpiling ES6 classes down to ES5 and am also having this problem using react-hot-loader. I think the issue is with the If I examine the When This definitely seems like an issue with the fixes:
I'm going to compile down to ES5 until |
Just another confirmation, we had this issue from binding methods in the constructor. With the same error and also loosing context for those components.
Using |
We have encountered the same errors as @HHogg on a TypeScript project (target ES2017 in dev, so it doesn't compile classes) with React 15.6.2 and react-hot-loader 3.1.1. We don't bind methods in the constructor but in the class body,
Reverting to 3.0.0-beta.7 solves the issue for us. |
Related to #662 and Babel transpilation. Fixed in next. |
Description
I'm facing a really strange issue in which every now and again my app stops working when running via webpack's hot dev server. When this issue presents itself, I struggle to get it to work again even after cleaning everything, stashing all git changes, resetting yarn.lock, etc.
In production builds I noticed this issue never occurs.
I have a simple component that renders two fields ("hostname" and "port"), and maintains the field values in the component's
state
. Essentially just this.Expected behavior
I expect in such a basic case that I should be able to update the form fields without issue - I enter text in a field, which triggers the field's
onChange
event, which in turn invokessetState
, updating the value thatthe field gets re-rendered with.
Actual behavior
I observe the expected behaviour every time in production, and some of the time during development. I have no idea why but sometimes after rebuilding certain modules I will see this issue again.
When it does occur, I'm not able to change the value of either of the fields, and instead I see the following error in the Electron console:
Environment
React Hot Loader version: 3.0.0-beta.7
node -v
: v7.7.2npm -v
: 5.0.3Operating system: Windows 7 64-bit
Browser and version: Electron (v1.7.3) chromium browser
Additional details
I traced the immediate cause of the issue.
The problem starts when I render my React tree right at the top-level in
index.tsx
:render(() => Routing(history));
Through a long chain of calls through the React (v15.6.1) library, we get to this point:
...where
Component
isAppContainer
.The React library passes the props, context and update queue to
AppContainer
. However,AppContainer
's constructor completely ignores the latter two of these arguments:This means that a little further up, we get
this.updater = updater || ReactNoopUpdateQueue
, whereupdater
is undefined (becauseAppContainer
dropped it), and so it gets set to the noop update queue which leads to the issue I'm seeing.This constructor is specifically for
AppContainer.dev.js
; the production version has a different constructor that doesn't lead to this issue, which is why my production builds are fine.Here's an image of the top part of the callstack:
The text was updated successfully, but these errors were encountered: