Fix repeatable WYSIWYG fields infinite loop after import (Issue #7465)#7487
Merged
sc0ttkclark merged 1 commit intopods-framework:mainfrom Feb 22, 2026
Conversation
The ReactQuill onChange handler was directly calling setValue, which caused an infinite render loop when: 1. ReactQuill fires onChange on mount/value changes 2. setValue updates React state 3. State update triggers re-render 4. ReactQuill sees 'new' value and fires onChange again Fixed by checking the source parameter - only call setValue when source is 'user' to prevent infinite loops on mount/programmatic updates. This follows the recommended approach from react-quill documentation.
PR Summary
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #7465 - Repeatable WYSIWYG fields become uneditable after WordPress content import, causing React error #185 ("Maximum update depth exceeded").
Problem Analysis
🔴 The Bug
When editing a post with repeatable WYSIWYG fields (using Quill editor) that were imported via WordPress XML Import, the fields become completely uneditable and the browser console shows:
This error means "Maximum update depth exceeded" - an infinite re-render loop in React.
🔍 Root Cause
The issue is in
ui/js/dfv/src/fields/wysiwyg/index.jswhere ReactQuill'sonChangehandler directly callssetValue:Why this causes an infinite loop:
onChange(content, delta, source)setValue(content)is called → updates React stateonChangeagainThe
sourceparameter in ReactQuill'sonChangetells us why the change happened:'user'= User typed/edited content'api'= Programmatic change (like setting initial value)'silent'= Internal change that shouldn't trigger events✅ The Fix
Only call
setValuewhen the change was initiated by the user:This is the recommended approach from react-quill documentation.
Code Changes
Before/After Diff
<ReactQuill value={ value || '' } onBlur={ () => setHasBlurred() } - onChange={ setValue } + onChange={ ( content, delta, source ) => { + // Only update state for user-initiated changes + // to prevent infinite loops on mount/programmatic updates + if ( source === 'user' ) { + setValue( content ); + } + } } theme="snow" modules={ { toolbar: QUILL_TOOLBAR_OPTIONS } } readOnly={ toBool( readOnly ) } />Files Changed
ui/js/dfv/src/fields/wysiwyg/index.jsonChangehandler to checksourceparameterTesting
Automated Tests
Manual Testing
How to Test
Screenshots
Before:

After:

Related