You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here's the problem, see the Stackblitz for a repro example:
A user uploads 0...n files, which we save in a state array in the parent component
Once the user clicks "Done", we copy the contents of that array into another state array in the parent
If we do that with primitive button handlers, it works as expected - however, whenever I click "Done" on the Dashboard, the parent state gets cleared. I've tried profiling this whether the parent component gets re-rendered, but looks like this is not the case. No idea what could be the cause of this, it seems as if the Dashboard is linked to a different DOM tree with old state values...? My react knowledge is not deep enough to fix this
Expected behavior
Parent state is updated properly
Actual behavior
Parent state is reset
The text was updated successfully, but these errors were encountered:
lmyslinski
changed the title
Dashboard doneButtonHandler resets parent state (without re-render)
[4.x] Dashboard doneButtonHandler resets parent state (without re-render)
Jun 12, 2024
Initial checklist
Link to runnable example
https://stackblitz.com/edit/vitejs-vite-bqeqye?file=src%2FUploadForm.tsx
Steps to reproduce
Here's the problem, see the Stackblitz for a repro example:
If we do that with primitive button handlers, it works as expected - however, whenever I click "Done" on the Dashboard, the parent state gets cleared. I've tried profiling this whether the parent component gets re-rendered, but looks like this is not the case. No idea what could be the cause of this, it seems as if the Dashboard is linked to a different DOM tree with old state values...? My react knowledge is not deep enough to fix this
Expected behavior
Parent state is updated properly
Actual behavior
Parent state is reset
The text was updated successfully, but these errors were encountered: