React-redux: setState warning using v5.0.0-rc.1 with redux-form.

Created on 9 Dec 2016  路  6Comments  路  Source: reduxjs/react-redux

The following error appears using [email protected] when I am unmounting component which renders redux-form's <Field /> component only if the <Field /> has been previously focused. I know that it seems like problem with redux-form but when I switch back to [email protected] everything works fine.

warning.js:36 Warning: setState(...): Can only update a mounted or mounting component. This usually means you called setState() on an unmounted component. This is a no-op. Please check the code for the Connect(ConnectedField) component.

Tested on OSX and [email protected] (64-bit) and [email protected] (12602.2.14.0.7)

How to reproduce

  1. Clone the repository https://github.com/pilaas/react-redux-bug
  2. yarn
  3. npm run start
  4. Open browser http://localhost:8080
  5. Open console and enter type store.dispatch({type: 'SHOW_FORM'});
  6. Focus newly appeared input component
  7. Enter store.dispatch({type: 'HIDE_FORM'}); in console
  8. Experience warning
bug

Most helpful comment

Pushed out a quick rc2 just now. I'll try to do 5.0.0 final tomorrow once I'm done with some stuff related to my move this weekend. Draft is ready for the release notes.

All 6 comments

Not to strawman/sidetrack too much, but why are you storing that kind of state in your store? It doesn't seem to be a business-level concern, just UI state. That kind of thing is best left to local React state instead.

It's just example project to demonstrate the problem. Programming patterns are not the case here. I don't need a workaround, I just report the bug (?).

Haven't tried to repro this yet, but gotta say, this is a _great_ bug report. Scenario description, error message, "How to repro", _and_ a cloneable repo that can reproduce the issue. Thanks!

I plan to take a loot at this today. Thanks, @pilaas.

Ah. The good news is this seems to be fixed if built against the head of next branch. @timdorr Any chance we can push an rc2?

Pushed out a quick rc2 just now. I'll try to do 5.0.0 final tomorrow once I'm done with some stuff related to my move this weekend. Draft is ready for the release notes.

Was this page helpful?
0 / 5 - 0 ratings