-
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
Unable to restore Theia state when webview and several editor tabs are opened #8621
Conversation
Signed-off-by: Vitaliy Gulyy <vgulyy@redhat.com>
Signed-off-by: Vitaliy Gulyy <vgulyy@redhat.com>
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.
I'm not convinced this is the right fix: if we don't have a WebviewPanelSerializer, shouldn't we just recreate the webview to it's default state? After all, there are webviews that simply do not have mutable state.
Could you point me to the code that disposes the widget if there's now WebviewPanelSerializer? I didn't find it.
Theia finds a WebviewPanelSerializer when saving the layout, as the serializer is used to get the webview html content. If the serializer is not registered for the webview, theia saves only widget ID, factory ID and empty content. theia/packages/plugin-ext/src/hosted/browser/hosted-plugin.ts Lines 204 to 209 in 8e3da24
Then when restoring the state after reload, Theia
|
The |
Could somebody check this PR? |
@akosyakov @vince-fugnitto could you please take a look? |
testing.... |
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.
Sorry I have not viewed the pull-request sooner, I was busy with EclipseCon.
I tested the functionality only at the moment, I see that editors are properly restored with this patch as compared to master
.
Hmh...the pressing F5 does not restore the order of the editors: python files always first. Checking master... |
Master seems to respect editor order. Need to look at that code again. |
Here's what I do:
|
What devfile did you use to test? After refreshing the page, the order of opened editors must be restored. |
No devfile, plain Theia.
That is correct, but the order of editors is not preserved in my case. Maybe we're iterating over property keys instead of an array somewhere? |
Signed-off-by: Vitaliy Gulyy <vgulyy@redhat.com>
Signed-off-by: Vitaliy Gulyy <vgulyy@redhat.com>
@tsmaeder I have just updated and double-checked the PR. The order of opened editors is preserved after refreshing the page. |
🤦 I'll have to double-check, then. I'm pretty confident I did not dream it. |
I'm still seeing reordering of the open files running the browser example when opening the following directory:
|
I reproduced the bug with your project. Sometimes (not always) the ordering of files is broken. |
@vitaliy-guliy of course:
compiles to
|
I'm glad I'm not crazy ;-) |
I created a PR #8680 with another approach. In that PR Theia does not store the webview if the serializer is not set. |
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.
I've tested it with the provided plug-in. The previously opened files are restored well. But with restoring a WebView I see two problems:
- the position of the WebView tab is not the same as it was before reloading the entire page
- the contributed WebView is restored anyway, even if I've already closed it before reloading the Theia page 😄
It's because the webview is not persisted and the plugin opens it next to active tab.
The plugin opens a webview always when Theia starts. |
Does that mean this PR should be closed? |
What it does
Fixes an error with restoring the editor area when a webview and several editors are opened.
Short video demonstrating a problem is here https://www.youtube.com/watch?v=9ir1hTov350
How to test
Follow 'Steps to reproduce' in the original issue #8620
This PR is also fixes #6877. I haven't investigated sources of GitLens extension, but the bug with webview+preferences is not reproducible anymore.
Review checklist
Reminder for reviewers