This PR Fixes a loading performance regresssion inside the git graph. The main issue is that we always acted on the received repository events, this is good in 9 out of 10 cases except for the initial loading phase of the git graph. This is because we invalidate the graph data every time we receive a `GitStoreEvent::ActiveRepositoryChanged`, `RepositoryEvent::BranchChanged` or `RepositoryEvent::MergeHeadsChanged` event this still sounds good, but the caveat is that we receive these 3 events on initial repository loading. This happens when you start up Zed and is getting the active repository, branch ect. from your project. When it detects a repository/branch etc. it checks if it has been changed and emits an event for it. This is always the case for initial repository loading, because the active repository/branch always start as **None**. So receive an event for these non actual changes makes the git graph cancel its initial loading and start fetching again on every invalidated graph data call. We fixed this by checking the **scan_id** of the repo to check if the repo has been initialized, if its bigger then 1 we know we need to invalidate the data because it was a actual user change instead of a initial loading event. **Before** (note you see the loading state twice): https://github.com/user-attachments/assets/c25bfae1-0e2f-4c8b-a0d0-926acb33adff **After** (almost instant): https://github.com/user-attachments/assets/7e4ac116-65a2-4eb6-aa4c-37291d6acd0f ----- **Before** (switching repositories shows empty commits pane) https://github.com/user-attachments/assets/71b04285-49e7-47bb-9660-ad53bbf15c46 **After** (switching repositories shows correct graph from the cache) https://github.com/user-attachments/assets/38c33d93-f592-4440-b63b-567fda0fbeb8 Before you mark this PR as ready for review, make sure that you have: - [x] Added a solid test coverage and/or screenshots from doing manual testing - [x] Done a self-review taking into account security and performance aspects - [x] Aligned any UI changes with the [UI checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) Release Notes: - N/A --------- Co-authored-by: Anthony <anthony@zed.dev> Co-authored-by: Anthony Eid <hello@anthonyeid.me>
Zed
Welcome to Zed, a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Installation
On macOS, Linux, and Windows you can download Zed directly or install Zed via your local package manager (macOS/Linux/Windows).
Other platforms are not yet available:
- Web (tracking issue)
Developing Zed
Contributing
See CONTRIBUTING.md for ways you can contribute to Zed.
Also... we're hiring! Check out our jobs page for open roles.
Licensing
License information for third party dependencies must be correctly provided for CI to pass.
We use cargo-about to automatically comply with open source licenses. If CI is failing, check the following:
- Is it showing a
no license specifiederror for a crate you've created? If so, addpublish = falseunder[package]in your crate's Cargo.toml. - Is the error
failed to satisfy license requirementsfor a dependency? If so, first determine what license the project has and whether this system is sufficient to comply with this license's requirements. If you're unsure, ask a lawyer. Once you've verified that this system is acceptable add the license's SPDX identifier to theacceptedarray inscript/licenses/zed-licenses.toml. - Is
cargo-aboutunable to find the license for a dependency? If so, add a clarification field at the end ofscript/licenses/zed-licenses.toml, as specified in the cargo-about book.
Sponsorship
Zed is developed by Zed Industries, Inc., a for-profit company.
If you’d like to financially support the project, you can do so via GitHub Sponsors. Sponsorships go directly to Zed Industries and are used as general company revenue. There are no perks or entitlements associated with sponsorship.