Skip to content

Commit

Permalink
add comment describing when/how the useEffect triggers
Browse files Browse the repository at this point in the history
  • Loading branch information
jrchudy committed Dec 19, 2023
1 parent c22eef8 commit 6b7e655
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/components/recordedit/form-row.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ const FormRow = ({
if (!formsRef || !formsRef.current || !showCloneSpinner) return;

if (formsRef.current.children.length === forms.length) setShowCloneSpinner(false);
// trigger this when number of forms changes
// `callAddForm` in /components/recordedit.tsx calls addForm(#_forms_to_add) which will then set the `forms` state variable
// once callAddForm finishes, react repaints the UI then will trigger this useEffect because forms was changed
// NOTE: it appears this useEffect is triggering after the "full repaint" even if there was a delay
}, [forms])
}

Expand Down

0 comments on commit 6b7e655

Please sign in to comment.