Skip to content

@remotion/studio: Fix JSON editor error state being immediately cleared#6956

Merged
JonnyBurger merged 1 commit intomainfrom
fix/json-editor-error-state-flicker
Apr 1, 2026
Merged

@remotion/studio: Fix JSON editor error state being immediately cleared#6956
JonnyBurger merged 1 commit intomainfrom
fix/json-editor-error-state-flicker

Conversation

@JonnyBurger
Copy link
Copy Markdown
Member

Summary

  • Fix flaky JSON editor e2e tests by removing localValue from the useEffect dependency array in RenderModalJSONPropsEditor
  • The useEffect that syncs local state with the parent value had localValue as a dependency, causing a feedback loop: typing invalid JSON would trigger the effect, which would overwrite the error state with the parent's last-known-good value
  • Uses a functional state updater (setLocalValue((prev) => ...)) to access previous state without needing localValue as a dependency

Test plan

  • Verify json-editor.test.mts e2e tests pass consistently (no longer flaky)
  • Verify JSON editor still syncs correctly when props change externally

🤖 Generated with Claude Code

…ared

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@pullfrog
Copy link
Copy Markdown
Contributor

pullfrog bot commented Apr 1, 2026

Reviewed PR #6956 — approved. The fix correctly eliminates the feedback loop by switching to a functional state updater, removing localValue from the useEffect dependency array.

Task list (4/4 completed)
  • Checkout PR and read the diff
  • Read the changed file and understand the bug fix
  • Trace data flow and verify correctness of the fix
  • Submit review or report progress

Pullfrog  | View workflow run | Triggered by Pullfrog | Using Big Pickle (free) | 𝕏

@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Apr 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
bugs Ready Ready Preview, Comment Apr 1, 2026 8:46am
remotion Ready Ready Preview, Comment Apr 1, 2026 8:46am

Request Review

Copy link
Copy Markdown
Contributor

@pullfrog pullfrog bot left a comment

Choose a reason for hiding this comment

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

Clean fix. The localValue dependency was causing the useEffect to re-fire on every local state change — including invalid JSON input — which overwrote the error state with the parent's stale good value. The functional updater correctly removes localValue from the dependency array while still accessing previous state for the deepEqual guard.

Pullfrog  | View workflow run | Using Big Pickle (free) | 𝕏

@JonnyBurger JonnyBurger merged commit 9a72913 into main Apr 1, 2026
19 checks passed
@JonnyBurger JonnyBurger deleted the fix/json-editor-error-state-flicker branch April 1, 2026 10:01
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