Repository navigation
fix: flush pending onChange on unmount - #2654
lucas-koehler merged 1 commit into
Conversation
✅ Deploy Preview for jsonforms-examples ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
lucas-koehler
left a comment
There was a problem hiding this comment.
The fix looks good to me 🚀 Thanks for the contribution ❤️
| useEffect(() => { | ||
| return () => { | ||
| debouncedEmit.flush(); | ||
| }; | ||
| }, [debouncedEmit]); |
There was a problem hiding this comment.
Small side effect: with React 18/19 StrictMode in dev, the simulated unmount runs this cleanup right after mount. So the initial onChange now fires twice (once from the sync flush, once from the re-run effect). I checked this with a minimal React 19 repro of this effect setup: 1 call without the flush, 2 with it. Both calls carry the same data and it only happens in dev, so I think that's acceptable. Just mentioning it so it isn't a surprise. No need to do anything about it though
|
@sean0407 Before we can merge this, please accept the contributor agreement. Without it, we cannot accept contributions. See this comment #2654 (comment) |
|
Hi @lucas-koehler, I’ve accepted the EclipseSource Contributor Agreement, and the license/cla check now shows SUCCESS. Thank you for reviewing and approving this PR. |
|
The CLA check now shows SUCCESS, and the PR remains approved with the Ubuntu, macOS, and Windows workflows passing. Could you merge when convenient, or let me know if another blocker remains? |
|
@sean0407 Thanks for the quick update on the CLA and the contribution in general! There are no more blockers. |
Summary
Flush the pending debounced
onChangewhenJsonFormsStateProviderunmounts, and cover the behavior with a regression test. Fixes #2616.Evidence
git diff --checkpassed.Merge Danger
Door: two-way
Blast Radius: localized
Only the React provider's pending callback lifecycle changes; the regression test covers unmount behavior.