Skip to content

Conversation

@kristencheung
Copy link
Contributor

@kristencheung kristencheung commented Sep 10, 2025

Description

This PR fixes an infinite loop caused by mutual updates between the editor's onChange handler and the query prop.

Previously, onChange would trigger onUpdateQuery, which updated the query prop.

A useEffect would then detect the new query and update the editor value again which would then retrigger the onChange handler, creating a loop.

Added a stable isSettingContent status ref to understand when the query is being updated and to return early from the onchange handler if it's active.

Checklist

  • Code compiles correctly and linting passes locally
  • For all code changes, an entry added to the CHANGELOG.md file describing and linking to
    this PR
  • Tests added for new functionality, or regression tests for bug fixes added as applicable
  • For public APIs, new features, etc., PR on docs repo
    staged and linked here

@vercel
Copy link

vercel bot commented Sep 10, 2025

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

Project Deployment Preview Comments Updated (UTC)
ratel Ready Ready Preview Comment Sep 10, 2025 3:21pm

@netlify
Copy link

netlify bot commented Sep 10, 2025

Deploy Preview for dgraph-play ready!

Name Link
🔨 Latest commit 619a32c
🔍 Latest deploy log https://app.netlify.com/projects/dgraph-play/deploys/68c1973628bdfb000858a037
😎 Deploy Preview https://deploy-preview-391--dgraph-play.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@kristencheung kristencheung marked this pull request as ready for review September 10, 2025 15:20
@kristencheung kristencheung merged commit 48b9899 into main Sep 10, 2025
12 checks passed
@kristencheung kristencheung deleted the kristen/fix-infinite-loop branch September 10, 2025 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants