-
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
Preferences - Responsive Scope Changes #7936
Preferences - Responsive Scope Changes #7936
Conversation
Signed-off-by: Colin Grant <[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.
@colin-grant-work I tested the behavior described from #7887 and it works correctly 👍
One improvement I noticed (possibly in a separate pull-request) is to also handle when switching between an editor and the preferences
widget. For example:
- open the preferences-widget and scroll down to a preference value (ex:
output.maxChannelHistory
) - open an editor (ex:
readme.md
) - navigate back to the preferences-widget
- notice how the preferences-widget is reset (does not preserve the location) and is re-rendered back to the top
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.
Works as expected
Thanks @colin-grant-work
@vince-fugnitto, I had hoped that this would do better at addressing the concerns you mention and move towards fixing #7746, but it seems the mechanisms are different. As I understand it (which may well be quite wrong 😄), one of two things is happening: (A) when the user leaves the preferences widget and returns, a signal is being sent that triggers a complete rerender. That should be easy to fix, since it would just mean changing how the widget responds to that particular signal. Alternatively, (B) when the user switches back and forth, the widget is temporarily deactivated, and in order to keep its state on its next activation, it would need to implement the logic to turn it into a stateful widget (which is probably desirable anyway). I think window switching is A, and closing and opening the preferences widget would be B - is that correct? |
@colin-grant-work as a reference, I have already tracked an issue on improving the statefulness of the The pull-request is however already an improvement and we could tackle this issue separately if you wish. |
So it sounds like the current problem is in what I described as scenario (A), where the widget's state doesn't need to be saved anywhere, it just needs to respond better to incoming events? If that's the case, I think it's worth taking a stab at as part of this PR, because it shouldn't be too much extra to change a listener - I'll give it a try later today. |
Sounds good! :) Please ping me whenever you're ready for a re-review. |
@vince-fugnitto , it took me a couple of days to circle back around to this. I've done some looking around, and it seems that the behavior is inconsistent. In the browser, just changing windows doesn't cause a scroll to top, but in Electron it does. Here's the browser during a show-hide sequence: And here's Electron with the same code: You can see that somewhere between Apart from the behavior on theia/packages/core/src/browser/widgets/widget.ts Lines 90 to 109 in 193c85f
|
@colin-grant-work thank you for taking the time to debug and investigate what is happening. Based on you findings I think the pull-request should be merged and we can fix the issue mentioned in a separate pr. If possible, can you open an issue so we can track the buggy behaviour? |
@vince-fugnitto what are we waiting for to merge this? |
Thank you for reminding me, I'll merge shortly :) |
Signed-off-by: Colin Grant [email protected]
What it does
Fixes #7887 by limiting the regeneration of the tree to cases when the visibility of elements is affected (search, preference schema change, or scope change from User/Workspace <---> Folder). If tree is not regenerated, only displayed values are changed. If tree is regenerated, a check is made to see whether the formerly selected element is still visible, and if it is, it is scrolled into view.
In reviewing some of the widget code, I've also added a bit of handling for errors that shouldn't occur, but could conceivably occur.
How to test
Review checklist
Reminder for reviewers