Skip to content
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

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

fgnass
Copy link
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
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.

1 participant