Infinite Loop in functional component
Open
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 163
- Forks
- 104
- PR merge metrics
- No merged PRs in 30d
Description
const ArticleForm = (props) => {
const {article} = props
const classes = useStyles();
const dispatch = useDispatch()
const router = useRouter()
const [editorState, setEditorState] = useState(EditorState.createEmpty());
const blocksFromHtml = htmlToDraft(article.body);
const { contentBlocks, entityMap } = blocksFromHtml;
const contentState = ContentState.createFromBlockArray(contentBlocks, entityMap);
const loadedEditorState= EditorState.createWithContent(contentState);
debugger
setEditorState(loadedEditorState)
the setEditorState is causing this error:

Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the reported infinite loop with the ArticleForm snippet, focusing on the setEditorState call after EditorState.createWithContent. Trace the component's render and state-update sequence, then verify the behavior and its fix with a focused test or reproduction; the payload names no repository file or existing test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100