decap-cms icon indicating copy to clipboard operation
decap-cms copied to clipboard

Error: bad setState() call inside FileControl and EntryCard

Open fgnass opened this issue 10 months ago • 0 comments

Describe the bug

When accessing an editor with an image widget, this error is logged to the console, the first time an asset is accessed:

hook.js:608 Warning: Cannot update a component (`Connect(_translate)`) while rendering a different component (`FileControl`). To locate the bad setState() call inside `FileControl`, follow the stack trace as described in https://reactjs.org/link/setstate-in-render Error Component Stack
    at FileControl (withFileControl.js:241:7)
    at Widget (Widget.js:21:5)
   ...

The same thing happens in EntryCard, when a preview image is requested for the first time.

To Reproduce

  • Checkout the decap-cms repo
  • Install dependencies and run npm start
  • Open http://localhost:8080/#/collections/kitchenSink/entries/a-big-entry-with-all-the-things
  • Look into the console

How to fix

I have a fix ready for this and will submit a PR.

fgnass avatar Feb 25 '25 09:02 fgnass