-
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
Invalid lifecycle for ReactDialog #12093
Comments
We have also noticed this after switching to Theia 1.31.1 and had to patch all the dialogs in the Theia app. For the time being, if anybody is interested in a workaround: arduino/arduino-ide@ac9cce1#diff-e9b03ff2d6226d1a82f1134e027997f6963315674476dfc2a6abcc7197891ede |
Thanks for the workaround @kittaakos! |
To workaround the React-based widget lifecycle issue: eclipse-theia/theia#12093. The dialog constructor is called once, hence the default `toDispose` listener will execute only once per app lifecycle. The default dialog close behavior (from Theia) will dispose the widget. On dialog reopen, the constructor won't be called again, as the dialog is injected as a singleton, but the React component has been unmounted on dialog dispose. Hence, they will be recreated. The `componentDidMount` method will be called, but the `componentWillUnmount` is not called anymore. The dialog is already disposed. It leads to a resource leak. Signed-off-by: Akos Kitta <[email protected]>
after call |
@CamilleLetavernier what are you suggesting should be done here? That we stop reusing dialogs in the Theia framework or that the lifecycle of dialogs be fixed? |
We seem to have a conceptual problem here:
I believe 3. is the only correct way, and here's why: when a client invokes |
I don't have hard any hard feelings in this topic. However it seems a bit weird to me that we have two fundamentally different concepts for widgets and dialogs although dialogs are also just widgets. Therefore I would tend to unify them by refactoring dialogs to NOT being singletons. |
@CamilleLetavernier I can only reproduce the problem with the about dialog in the browser version of Theia. |
@sdirix I belive that's the wrong approach to fix this "right" as argued above. |
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]>
Fixes #12093 The about dialog in Theia is reopened and must no be disposed on close. Contributed on behalf of STMicroelectronics
Bug Description:
In #11669, a fix was provided to support re-opening a ReactDialog that had been closed. However, trying to reopen/reuse a widget that has been previously disposed violates the widget API, which may cause further issues. Especially, BaseWidget.dispose() can only be invoked once, so the reused/revived widget can no longer be disposed after this.
As a consequence, dialogs based on ReactDialog now have an inconsistent lifecycle, which causes errors:
My understanding is that we shouldn't be trying to reuse closed (disposed) Dialogs in the first place; instead, a new instance of the dialog should be created after the previous one was closed/disposed.
Steps to Reproduce:
Additional Information
The text was updated successfully, but these errors were encountered: