Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.x] Dashboard doneButtonHandler resets parent state (without re-render) #5248

Closed
2 tasks done
lmyslinski opened this issue Jun 12, 2024 · 4 comments · Fixed by #5260
Closed
2 tasks done

[4.x] Dashboard doneButtonHandler resets parent state (without re-render) #5248

lmyslinski opened this issue Jun 12, 2024 · 4 comments · Fixed by #5260
Assignees
Labels
Bug React React components or other React integration issues

Comments

@lmyslinski
Copy link

Initial checklist

  • I understand this is a bug report and questions should be posted in the Community Forum
  • I searched issues and couldn’t find anything (or linked relevant results below)

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:

  • 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

@lmyslinski lmyslinski added the Bug label Jun 12, 2024
@lmyslinski 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
@MasterOfBrokenLogic
Copy link

oh!

@Murderlon
Copy link
Member

Hi, I'm not sure what's going on but the same happens on 3.x so it's probably always been the case.

@Murderlon
Copy link
Member

We think we know what we issue is. We'll report back.

@Murderlon Murderlon added the React React components or other React integration issues label Jun 17, 2024
@lmyslinski
Copy link
Author

lmyslinski commented Jun 18, 2024

We think we know what we issue is. We'll report back.

Many thanks for looking into this. Super curious as to what the cause could be

mifi added a commit that referenced this issue Jun 18, 2024
(when react props change)

fixes #5248
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug React React components or other React integration issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants