Skip to content

Fix(#7414): Fix React's bad setState() call warnings#7416

Merged
martinjagodic merged 7 commits into
decaporg:mainfrom
fgnass:fix/7414
May 15, 2026
Merged

Fix(#7414): Fix React's bad setState() call warnings#7416
martinjagodic merged 7 commits into
decaporg:mainfrom
fgnass:fix/7414

Conversation

@fgnass
Copy link
Copy Markdown
Contributor

@fgnass fgnass commented Feb 25, 2025

This PR fixes the warnings React logs to the console when an asset preview is shown for the first time (see #7414).

The issue is caused because getAsset dispatches an action, which in turn triggers a state update. I haven't done any Redux in a while, so there might be better patterns to fix this, but this at least does the trick.

While fixing this, I stumbled over two other problems in the console logs:

  1. A PropType warning regarding ObjectPreview.field: This is declared as Node, but in reality an immutable map is passed.
  2. A 404 error when trying to load assets while visualEditing is turned on. I filed this as Error: Visual editing breaks image previews #7415 and included a quick fix here that simply disables visualEditing for the posts collection in dev-test.

@fgnass fgnass requested a review from a team as a code owner February 25, 2025 14:09
Copy link
Copy Markdown
Contributor

@yanthomasdev yanthomasdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @fgnass, LGTM

@martinjagodic martinjagodic enabled auto-merge (squash) May 15, 2026 06:28
@martinjagodic martinjagodic merged commit 5be1d7a into decaporg:main May 15, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants