-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Race Condition in Branch Focus Rendering #4267
Comments
@ChrisMcD1 Thanks for the detailed investigation, this was very helpful in fixing the issue. Here's a PR: #4268 |
I'm a bit surprised by this; it's true that #4195 itself doesn't say much about what it fixes, but the issue it references (#4179) is quite clear about that (if you scroll down and read all the comments); also, ff4ae4a contains an integration test that describes very concise reproduction steps. I'm just trying to learn what I should have done better to make things more obvious. I'm trying quite hard to document all my changes in ways that make it easy to understand them later. |
I agree! My comment was actually actually less that "I don't understand what the crash was", and rather "I don't understand how #4195 doesn't fully break the focusing of branches". It's a lack of understanding around the lifecycle of when |
Ah I see. Never mind then! And to be very honest, I don't fully understand that either... |
Describe the bug
There is now a race condition between the selection of the focused branch, and the rendering of the view, due to the changes to refresh_helper in ff4ae4a. One way this manifests itself as a flaky integration test
custom_commands/suggestions_preset
To Reproduce
Steps to reproduce the behavior:
I discovered the problem when my pre-PR checks failed on #4261
It is tough to reproduce locally, but I am reliably able to do it with this script:
Expected behavior
I expect the integration test to pass.
Version info:
Building on master on
01eece3737f9
git version 2.25.1
Additional context
I added some local println debugging in, and here is what it showed on a failed run
On a successful run done with
-sandbox
on the integration test, we instead see:with the only difference being that the
SetSelectedIndex
was called before theSetFocusPoint
in the render of the list.https://github.com/ChrisMcD1/lazygit/blob/7d5d3c5ce5859d45af7bc731ed786b972a677aa1/pkg/gui/controllers/helpers/refresh_helper.go#L504-L513
Branch with the printlns can be found at https://github.com/ChrisMcD1/lazygit/tree/reproducing-broken. It's unclear to me the conditions that #4195 solves, which is why I am making an issue instead of a fix! It seems logical to me that we need to render the branch view after setting the selected index, so I must be missing something.
I don't think I can run
--debug
in an integration test to give more logs. If I can, please let me know how!The text was updated successfully, but these errors were encountered: