Web IDE - Opening two files quickly sometimes results in incorrect content
Summary
Opening two files (first large, second small) results sometimes (roughly 1 in 5 attempts) in the second file being empty. The user can go to the review tab and discard the "change" to see the full content again.
Steps to reproduce
- Open Web IDE in gitlab.com (https://gitlab.com/-/ide/project/gitlab-org/gitter/webapp/tree/develop/-/)
- Open a large text file (
package-lock.json
) - Immediately open another text file (
package.json
)
Example Project
https://gitlab.com/-/ide/project/gitlab-org/gitter/webapp/tree/develop/-/
What is the current bug behavior?
File content is empty, exactly the same way if the user deleted all content (it's uncommitted change).
What is the expected correct behavior?
The second file opens with all its content.
Relevant logs and/or screenshots
Possible fixes
This issue is most likely related to #214824 (closed). Even though it manifests itself differently. The mentioned issue showed just empty file as if that was the server version, this issue causes the file content to be marked as deleted in the Web IDE and so the change can be discarded).
There is a small chance that this race condition happens between the two actions fetching file data: !33391 (comment 358254818)