-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Do not dispose dialogs on close #14456
Do not dispose dialogs on close #14456
Conversation
Fixes eclipse-theia#12093 The about dialog in Theia is reopened and must no be disposed on close. Contributed on behalf of STMicroelectronics Signed-off-by: Thomas Mäder <[email protected]>
Signed-off-by: Thomas Mäder <[email protected]>
Signed-off-by: Thomas Mäder <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the changes.
I tested all mentioned scenarios in the browser. There I could not see any errors.
I also tested all mentioned scenarios in Electron. There I was able to reproduce the following error when opening the about dialog multiple times: ERROR Warning: You are calling ReactDOMClient.createRoot() on a container that has already been passed to createRoot() before. Instead, call root.render() on the existing root instead if you want to update it.
The other test scenarios did not produce any errors.
@sdirix I just opened and closed ( |
I retested and could no longer reproduce the issue. Not sure what I did different than the first time. As it could be a mistake on my side, I don't see this as a blocker no more. A question before we merge the current state: Do you think it's really worth it to overwrite the As an alternative we could adapt the |
It's not about that one dialog: by having that dialog, we're communicating that it's O.K. to reopen dialogs. The documented contract for |
What it does
Fixes #12093
The about dialog in Theia is reopened and must no be disposed on close. This PR overrides the
onCloseRequest
method fromBaseWidget
to not invokedispose()
. In order to minimize impact for clients of the API, I've added an optional parameter to theopen()
method that controls whether the dialog is disposed when it is closed.This change might be breaking in the case where clients reuse dialog instances and do not rely on
open()
to show the dialog. In that case, they will have to dispose the dialog themselves now. That should be a very rare case, though.Contributed on behalf of STMicroelectronics
How to test
Ensure these scenarios work correctly in the browser and Electron case.
Follow-ups
BaseWidget
lifecycle #14455Review checklist
Reminder for reviewers