Commit 4419b98
[1954] fix(ui): use useEffect instead of useMemo for onChange side effect
Devin review flagged the useMemoOnChange helper at CloudsYamlInput.tsx
for misusing useMemo as a side-effect hook: useMemo is for pure
memoization, not for calling a parent state-updating callback during
render. The pattern produces the React 18 "Cannot update a component
while rendering a different component" warning and risks a render
loop when the parent re-renders the child with new props. In
concurrent mode, useMemo callbacks may also fire multiple times
without committing.
Inlined the body into a regular useEffect with an explicit
deps array and an eslint-disable comment documenting why onChange is
intentionally excluded (parent-supplied callback whose identity may
change every render; including it would re-fire the effect on every
parent re-render).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent c65763d commit 4419b98
1 file changed
Lines changed: 9 additions & 14 deletions
Lines changed: 9 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | | - | |
84 | | - | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
85 | 87 | | |
86 | 88 | | |
87 | 89 | | |
88 | 90 | | |
89 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
90 | 96 | | |
91 | 97 | | |
92 | 98 | | |
| |||
212 | 218 | | |
213 | 219 | | |
214 | 220 | | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
0 commit comments