chore: improve performance #9

Merged
reya merged 3 commits from fix-perf into master 2026-09-01 02:05:25 +00:00
3 changed files with 109 additions and 85 deletions
Showing only changes of commit d4f9203707 - Show all commits
Generated
+70 -69
View File
@@ -1238,7 +1238,7 @@ dependencies = [
[[package]]
name = "collections"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38"
source = "git+https://github.com/zed-industries/zed#ce48461eaadd16c65c31f835511ab96bd3b6e746"
dependencies = [
"gpui_util",
"indexmap",
@@ -1704,7 +1704,7 @@ dependencies = [
[[package]]
name = "derive_refineable"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38"
source = "git+https://github.com/zed-industries/zed#ce48461eaadd16c65c31f835511ab96bd3b6e746"
dependencies = [
"proc-macro2",
"quote",
@@ -3484,7 +3484,7 @@ dependencies = [
[[package]]
name = "gpui"
version = "0.2.2"
source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38"
source = "git+https://github.com/zed-industries/zed#ce48461eaadd16c65c31f835511ab96bd3b6e746"
dependencies = [
"accesskit",
"anyhow",
@@ -3555,17 +3555,21 @@ dependencies = [
[[package]]
name = "gpui-base"
version = "0.5.2"
source = "git+https://github.com/longbridge/gpui-component#b4393e22d3a04a880bc187dfdabca9b1eeee270a"
source = "git+https://github.com/longbridge/gpui-component#c5ade4889153094b23bf438ada7e58a23c0a96e6"
dependencies = [
"aho-corasick",
"anyhow",
"async-channel",
"chrono",
"futures",
"gpui",
"gpui_macros",
"gpui_platform",
"html5ever",
"instant",
"lsp-types",
"markdown",
"markup5ever_rcdom",
"objc2 0.6.4",
"objc2-app-kit 0.3.2",
"objc2-foundation 0.3.2",
@@ -3587,25 +3591,22 @@ dependencies = [
[[package]]
name = "gpui-component"
version = "0.5.2"
source = "git+https://github.com/longbridge/gpui-component#b4393e22d3a04a880bc187dfdabca9b1eeee270a"
source = "git+https://github.com/longbridge/gpui-component#c5ade4889153094b23bf438ada7e58a23c0a96e6"
dependencies = [
"anyhow",
"chrono",
"core-text",
"enum-iterator",
"futures",
"gpui",
"gpui-base",
"gpui-component-assets",
"gpui-component-macros",
"gpui_macros",
"html5ever",
"instant",
"itertools 0.13.0",
"log",
"lsp-types",
"markdown",
"markup5ever_rcdom",
"notify",
"num-traits",
"objc2 0.6.4",
@@ -3667,7 +3668,7 @@ dependencies = [
[[package]]
name = "gpui-component-assets"
version = "0.5.1"
source = "git+https://github.com/longbridge/gpui-component#b4393e22d3a04a880bc187dfdabca9b1eeee270a"
source = "git+https://github.com/longbridge/gpui-component#c5ade4889153094b23bf438ada7e58a23c0a96e6"
dependencies = [
"anyhow",
"gpui",
@@ -3681,7 +3682,7 @@ dependencies = [
[[package]]
name = "gpui-component-macros"
version = "0.5.1"
source = "git+https://github.com/longbridge/gpui-component#b4393e22d3a04a880bc187dfdabca9b1eeee270a"
source = "git+https://github.com/longbridge/gpui-component#c5ade4889153094b23bf438ada7e58a23c0a96e6"
dependencies = [
"proc-macro2",
"quote",
@@ -3691,7 +3692,7 @@ dependencies = [
[[package]]
name = "gpui_apple"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38"
source = "git+https://github.com/zed-industries/zed#ce48461eaadd16c65c31f835511ab96bd3b6e746"
dependencies = [
"anyhow",
"block",
@@ -3714,7 +3715,7 @@ dependencies = [
[[package]]
name = "gpui_linux"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38"
source = "git+https://github.com/zed-industries/zed#ce48461eaadd16c65c31f835511ab96bd3b6e746"
dependencies = [
"accesskit",
"accesskit_unix",
@@ -3760,7 +3761,7 @@ dependencies = [
[[package]]
name = "gpui_macos"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38"
source = "git+https://github.com/zed-industries/zed#ce48461eaadd16c65c31f835511ab96bd3b6e746"
dependencies = [
"accesskit",
"accesskit_macos",
@@ -3806,7 +3807,7 @@ dependencies = [
[[package]]
name = "gpui_macros"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38"
source = "git+https://github.com/zed-industries/zed#ce48461eaadd16c65c31f835511ab96bd3b6e746"
dependencies = [
"heck 0.5.0",
"proc-macro2",
@@ -3817,7 +3818,7 @@ dependencies = [
[[package]]
name = "gpui_platform"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38"
source = "git+https://github.com/zed-industries/zed#ce48461eaadd16c65c31f835511ab96bd3b6e746"
dependencies = [
"console_error_panic_hook",
"gpui",
@@ -3830,7 +3831,7 @@ dependencies = [
[[package]]
name = "gpui_shared_string"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38"
source = "git+https://github.com/zed-industries/zed#ce48461eaadd16c65c31f835511ab96bd3b6e746"
dependencies = [
"schemars",
"serde",
@@ -3840,7 +3841,7 @@ dependencies = [
[[package]]
name = "gpui_util"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38"
source = "git+https://github.com/zed-industries/zed#ce48461eaadd16c65c31f835511ab96bd3b6e746"
dependencies = [
"anyhow",
"log",
@@ -3850,7 +3851,7 @@ dependencies = [
[[package]]
name = "gpui_web"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38"
source = "git+https://github.com/zed-industries/zed#ce48461eaadd16c65c31f835511ab96bd3b6e746"
dependencies = [
"anyhow",
"console_error_panic_hook",
@@ -3874,7 +3875,7 @@ dependencies = [
[[package]]
name = "gpui_wgpu"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38"
source = "git+https://github.com/zed-industries/zed#ce48461eaadd16c65c31f835511ab96bd3b6e746"
dependencies = [
"anyhow",
"bytemuck",
@@ -3900,7 +3901,7 @@ dependencies = [
[[package]]
name = "gpui_windows"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38"
source = "git+https://github.com/zed-industries/zed#ce48461eaadd16c65c31f835511ab96bd3b6e746"
dependencies = [
"accesskit",
"accesskit_windows",
@@ -4093,9 +4094,9 @@ dependencies = [
[[package]]
name = "hermit-abi"
version = "0.5.2"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c"
checksum = "e17592d60ebacc7d5e169f4663c5f84f9161cc90328abcfe8456f41e4dfcb284"
[[package]]
name = "hex"
@@ -4204,7 +4205,7 @@ dependencies = [
[[package]]
name = "http_client"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38"
source = "git+https://github.com/zed-industries/zed#ce48461eaadd16c65c31f835511ab96bd3b6e746"
dependencies = [
"anyhow",
"async-compression",
@@ -4224,7 +4225,7 @@ dependencies = [
[[package]]
name = "http_client_tls"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38"
source = "git+https://github.com/zed-industries/zed#ce48461eaadd16c65c31f835511ab96bd3b6e746"
dependencies = [
"log",
"rustls",
@@ -5043,9 +5044,9 @@ dependencies = [
[[package]]
name = "lyon_algorithms"
version = "1.0.20"
version = "1.0.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8575c0d003ae459399623c4def180c63b77f343b1a7fee64f249b349e7699a31"
checksum = "cdfa8785f95e57914ddb35e3b59994aeba6f5e79e9cfd03da1c269f010f36009"
dependencies = [
"lyon_path",
"num-traits",
@@ -5074,9 +5075,9 @@ dependencies = [
[[package]]
name = "lyon_tessellation"
version = "1.0.20"
version = "1.0.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e43b7e44161571868f5c931d12583592c223c5583eef86b08aa02b7048a3552"
checksum = "dabea159dc6eea9171a541b458134b70ca95e3162d068132b2b3b9bc01aad06e"
dependencies = [
"float_next_after",
"lyon_path",
@@ -5180,7 +5181,7 @@ dependencies = [
[[package]]
name = "media"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38"
source = "git+https://github.com/zed-industries/zed#ce48461eaadd16c65c31f835511ab96bd3b6e746"
dependencies = [
"anyhow",
"bindgen",
@@ -5404,8 +5405,8 @@ dependencies = [
[[package]]
name = "nostr"
version = "0.45.3"
source = "git+https://github.com/rust-nostr/nostr#ea38c0e3b2fc2717a4a55d019560a5574baf8cd0"
version = "0.45.4"
source = "git+https://github.com/rust-nostr/nostr#472c8839ea3f532259435d0513bf155ddeb467ba"
dependencies = [
"aes",
"base64",
@@ -5431,7 +5432,7 @@ dependencies = [
[[package]]
name = "nostr-connect"
version = "0.45.1"
source = "git+https://github.com/rust-nostr/nostr#ea38c0e3b2fc2717a4a55d019560a5574baf8cd0"
source = "git+https://github.com/rust-nostr/nostr#472c8839ea3f532259435d0513bf155ddeb467ba"
dependencies = [
"async-utility",
"futures-core",
@@ -5445,7 +5446,7 @@ dependencies = [
[[package]]
name = "nostr-database"
version = "0.45.1"
source = "git+https://github.com/rust-nostr/nostr#ea38c0e3b2fc2717a4a55d019560a5574baf8cd0"
source = "git+https://github.com/rust-nostr/nostr#472c8839ea3f532259435d0513bf155ddeb467ba"
dependencies = [
"nostr",
"opaquerr",
@@ -5454,7 +5455,7 @@ dependencies = [
[[package]]
name = "nostr-gossip"
version = "0.45.0"
source = "git+https://github.com/rust-nostr/nostr#ea38c0e3b2fc2717a4a55d019560a5574baf8cd0"
source = "git+https://github.com/rust-nostr/nostr#472c8839ea3f532259435d0513bf155ddeb467ba"
dependencies = [
"nostr",
"opaquerr",
@@ -5463,7 +5464,7 @@ dependencies = [
[[package]]
name = "nostr-gossip-memory"
version = "0.45.0"
source = "git+https://github.com/rust-nostr/nostr#ea38c0e3b2fc2717a4a55d019560a5574baf8cd0"
source = "git+https://github.com/rust-nostr/nostr#472c8839ea3f532259435d0513bf155ddeb467ba"
dependencies = [
"indexmap",
"lru",
@@ -5475,7 +5476,7 @@ dependencies = [
[[package]]
name = "nostr-lmdb"
version = "0.45.2"
source = "git+https://github.com/rust-nostr/nostr#ea38c0e3b2fc2717a4a55d019560a5574baf8cd0"
source = "git+https://github.com/rust-nostr/nostr#472c8839ea3f532259435d0513bf155ddeb467ba"
dependencies = [
"async-utility",
"flatbuffers",
@@ -5490,7 +5491,7 @@ dependencies = [
[[package]]
name = "nostr-memory"
version = "0.45.1"
source = "git+https://github.com/rust-nostr/nostr#ea38c0e3b2fc2717a4a55d019560a5574baf8cd0"
source = "git+https://github.com/rust-nostr/nostr#472c8839ea3f532259435d0513bf155ddeb467ba"
dependencies = [
"btreecap",
"nostr",
@@ -5501,7 +5502,7 @@ dependencies = [
[[package]]
name = "nostr-sdk"
version = "0.45.2"
source = "git+https://github.com/rust-nostr/nostr#ea38c0e3b2fc2717a4a55d019560a5574baf8cd0"
source = "git+https://github.com/rust-nostr/nostr#472c8839ea3f532259435d0513bf155ddeb467ba"
dependencies = [
"async-utility",
"async-wsocket",
@@ -6228,7 +6229,7 @@ checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"
[[package]]
name = "perf"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38"
source = "git+https://github.com/zed-industries/zed#ce48461eaadd16c65c31f835511ab96bd3b6e746"
dependencies = [
"collections",
"serde",
@@ -7016,7 +7017,7 @@ dependencies = [
[[package]]
name = "refineable"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38"
source = "git+https://github.com/zed-industries/zed#ce48461eaadd16c65c31f835511ab96bd3b6e746"
dependencies = [
"derive_refineable",
]
@@ -7099,7 +7100,7 @@ dependencies = [
[[package]]
name = "reqwest_client"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38"
source = "git+https://github.com/zed-industries/zed#ce48461eaadd16c65c31f835511ab96bd3b6e746"
dependencies = [
"anyhow",
"bytes",
@@ -7477,7 +7478,7 @@ dependencies = [
[[package]]
name = "scheduler"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38"
source = "git+https://github.com/zed-industries/zed#ce48461eaadd16c65c31f835511ab96bd3b6e746"
dependencies = [
"async-task",
"backtrace",
@@ -8172,7 +8173,7 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
[[package]]
name = "sum_tree"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38"
source = "git+https://github.com/zed-industries/zed#ce48461eaadd16c65c31f835511ab96bd3b6e746"
dependencies = [
"heapless 0.9.3",
"log",
@@ -8183,15 +8184,15 @@ dependencies = [
[[package]]
name = "sval"
version = "2.21.1"
version = "2.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec4a2a7d92fa86fcc6222e4c3845f8486cff899d9db32480b26c91a5dbf2e22d"
checksum = "b81b254da21fe1fcc4e3a74fe39b46e25e3a863078f8b71c954d47f84889dbc6"
[[package]]
name = "sval_buffer"
version = "2.21.1"
version = "2.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4324db9ac500c609d659b752edf9c8abbf2233f8afd61a503fd6f88ed625032"
checksum = "50be352d2822ffafb59e3e2ddac9d5ee60f2eeadbb7b5a2a951b9f3651e87a6f"
dependencies = [
"sval",
"sval_ref",
@@ -8200,18 +8201,18 @@ dependencies = [
[[package]]
name = "sval_dynamic"
version = "2.21.1"
version = "2.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4046add0eecf55e680b9e207edf5fc7737b18a1d950db363d97e7f1b2d7c629c"
checksum = "b048ca293b998d9a45659159f94a64063791e74cdc670164943dbb434405573d"
dependencies = [
"sval",
]
[[package]]
name = "sval_fmt"
version = "2.21.1"
version = "2.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "911a3486b5984a0a4f25edefcf2c2dba23654c29f63e75493b671d338bf24243"
checksum = "e6b5888e40f80568733217f27b7317b845f463400ced36c424b1a804730e53b2"
dependencies = [
"itoa",
"ryu",
@@ -8220,9 +8221,9 @@ dependencies = [
[[package]]
name = "sval_json"
version = "2.21.1"
version = "2.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da53aae7c737b5b5f1be4bcb0ff20e057bf6b2ee4e9d025560075c5830d09f95"
checksum = "e17664d6bb6b74947afaab9d7c991caa9bf5638d4dee16fcbef637f440796049"
dependencies = [
"itoa",
"ryu",
@@ -8231,9 +8232,9 @@ dependencies = [
[[package]]
name = "sval_nested"
version = "2.21.1"
version = "2.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df24df43cbdc4bb8c9f5ed19d0d57dc8f60a1a4259cdce52d597fe774ad3a71f"
checksum = "07c059969ca5ca163ea7fef6c9661758973d17691aba92abdcf5c428f4ec122c"
dependencies = [
"sval",
"sval_buffer",
@@ -8242,18 +8243,18 @@ dependencies = [
[[package]]
name = "sval_ref"
version = "2.21.1"
version = "2.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2bebc17f0f1fad060e57b778728d41ef87627e9111a6365d7463472cb58fc1b3"
checksum = "42d6b29ff568c85c87561807f51d2adfff4b6016c6363133f7cd1652a12548f3"
dependencies = [
"sval",
]
[[package]]
name = "sval_serde"
version = "2.21.1"
version = "2.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f26fe3f6a68b40e6c8d654ea48c00e4316272fddf68c80493714c1b034ae70b"
checksum = "8f33ec9edc42b12764d5c90ca0a1d84189c6bde81ed27507f1e661c6e4e05853"
dependencies = [
"serde_core",
"sval",
@@ -9121,9 +9122,9 @@ dependencies = [
[[package]]
name = "tree-sitter-language"
version = "0.1.7"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "009994f150cc0cd50ff54917d5bc8bffe8cad10ca10d81c34da2ec421ae61782"
checksum = "ca0d1bf6fdd806e43ae5198f82f527056d359def39e54e67a0f478ac09dac081"
[[package]]
name = "tree-sitter-lua"
@@ -9556,7 +9557,7 @@ checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
[[package]]
name = "util_macros"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38"
source = "git+https://github.com/zed-industries/zed#ce48461eaadd16c65c31f835511ab96bd3b6e746"
dependencies = [
"perf",
"quote",
@@ -9612,9 +9613,9 @@ dependencies = [
[[package]]
name = "value-bag-serde1"
version = "1.13.2"
version = "1.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "417d6197dd0ee696783d6be4276ac6ea74b985e00024c85ccfb37aff4f2bed82"
checksum = "27780e3aec98b13ac796bc0d5770205ee6e976d1ccb33a52da70b73ff0ff880d"
dependencies = [
"erased-serde",
"serde_core",
@@ -9623,9 +9624,9 @@ dependencies = [
[[package]]
name = "value-bag-sval2"
version = "1.13.2"
version = "1.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c61f7251ecde2c9ed431bbe0659853e7991753447447bbf1ae59d8b31c578d4e"
checksum = "1c093d229c7ead9974b640e61170976e0eff3dac447cf6792c645f0b7f28b3de"
dependencies = [
"sval",
"sval_buffer",
@@ -11321,7 +11322,7 @@ checksum = "34b31d188d9d685a4f9c7b46d6e36631b07058d2cfe190267adce54dc230bf12"
[[package]]
name = "zlog"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38"
source = "git+https://github.com/zed-industries/zed#ce48461eaadd16c65c31f835511ab96bd3b6e746"
dependencies = [
"anyhow",
"chrono",
@@ -11338,7 +11339,7 @@ checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b"
[[package]]
name = "ztracing"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38"
source = "git+https://github.com/zed-industries/zed#ce48461eaadd16c65c31f835511ab96bd3b6e746"
dependencies = [
"tracing",
"tracing-subscriber",
@@ -11349,7 +11350,7 @@ dependencies = [
[[package]]
name = "ztracing_macro"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38"
source = "git+https://github.com/zed-industries/zed#ce48461eaadd16c65c31f835511ab96bd3b6e746"
[[package]]
name = "zune-core"
+26 -11
View File
@@ -444,9 +444,9 @@ impl RepoDetailView {
return;
}
if let Ok(Some((branches, tags, current_branch, head_commit))) = refresh {
let branches: Vec<SharedString> =
branches.into_iter().map(Into::into).collect();
let tags: Vec<SharedString> = tags.into_iter().map(Into::into).collect();
let branches: Vec<SharedString> = branches.iter().map(Into::into).collect();
let tags: Vec<SharedString> = tags.iter().map(Into::into).collect();
this.branch_select.update(cx, |state, cx| {
state.set_items(SearchableVec::from(branches), window, cx);
if let Some(branch) = current_branch {
@@ -454,14 +454,22 @@ impl RepoDetailView {
state.set_selected_values(&[branch], window, cx);
}
});
this.tag_select.update(cx, |state, cx| {
state.set_items(SearchableVec::from(tags), window, cx);
});
let new_head_commit = head_commit.as_ref().map(|c| &c.id);
let current_head_commit = this.head_commit.as_ref().map(|c| &c.id);
let head_changed = new_head_commit != current_head_commit;
this.head_commit = head_commit;
// The fetch may have brought new commits: reload the list.
if head_changed || this.all_commits.is_none() {
this.all_commits = None;
this.loading_all_commits = false;
this.load_all_commits(cx);
}
cx.notify();
}
})?;
@@ -472,8 +480,8 @@ impl RepoDetailView {
self.tasks.push(task);
}
/// Apply the loaded repository data: explorer tree, README preview, ref
/// selectors and HEAD commit, then start the commit-list walk.
/// Apply the loaded repository data: explorer tree, README preview,
/// ref selectors and HEAD commit, then start the commit-list walk.
fn apply_repo_data(&mut self, data: RepoData, window: &mut Window, cx: &mut Context<Self>) {
let RepoData {
tree,
@@ -496,10 +504,11 @@ impl RepoDetailView {
state.set_items(tree_items(tree, false), cx);
});
// Populate the branch/tag selectors with the local refs, selecting
// the branch HEAD points to.
// Populate the branch/tag selectors with the local refs,
// selecting the branch HEAD points to.
let branches: Vec<SharedString> = branches.into_iter().map(Into::into).collect();
let tags: Vec<SharedString> = tags.into_iter().map(Into::into).collect();
self.branch_select.update(cx, |state, cx| {
state.set_items(SearchableVec::from(branches), window, cx);
if let Some(branch) = current_branch {
@@ -507,11 +516,13 @@ impl RepoDetailView {
state.set_selected_values(&[branch], window, cx);
}
});
self.tag_select.update(cx, |state, cx| {
state.set_items(SearchableVec::from(tags), window, cx);
});
self.load_all_commits(cx);
if let Some((path, bytes)) = readme_path.zip(readme) {
self.readme_name = Some(path.to_string_lossy().into());
self.load_commit(&path.to_string_lossy(), cx);
@@ -521,8 +532,8 @@ impl RepoDetailView {
}
}
/// Clone the repository into a folder chosen by the user (outside the
/// cache), then open the new clone in the system file manager.
/// Clone the repository into a folder chosen by the user (outside the cache),
/// then open the new clone in the system file manager.
fn clone_to_folder(&mut self, window: &mut Window, cx: &mut Context<Self>) {
if self.cloning {
return;
@@ -1240,7 +1251,11 @@ impl RepoDetailView {
.filter(|nip05| !nip05.trim().is_empty());
let key = (source.event_id, nip05);
if self.header_cache.as_ref().is_none_or(|cache| cache.key != key) {
if self
.header_cache
.as_ref()
.is_none_or(|cache| cache.key != key)
{
let announcement = source.clone();
let share = ShareTargets::from_announcement(&announcement);
let nostr_url = nostr_clone_url(&announcement, key.1.as_deref());
@@ -80,7 +80,8 @@ pub struct PullRequestsView {
/// virtual list renders this slice. Rebuilt only when the store
/// version or the filter changes, keyed by [`Self::cache_key`].
visible_prs: Vec<usize>,
/// Header counts `(total, open, closed, draft, merged)`, rebuilt with
/// Header counts `(total, open, closed, draft, merged)` of the root
/// pull requests only (revisions are not separate PRs), rebuilt with
/// [`Self::visible_prs`].
counts: (usize, usize, usize, usize, usize),
/// Store version and filter the cached rows/counts were built from.
@@ -549,6 +550,13 @@ impl Render for PullRequestsView {
.iter()
.enumerate()
.filter_map(|(ix, pr)| {
// Kind-30620 patches are revisions of a root PR (NIP-34),
// not separate pull requests: count only root events, or
// the header counts inflate with every revision (which
// also default to `Open` in `status_of`).
if pr.kind != Kind::GitPullRequest {
return None;
}
let status = store.status_of(pr);
counts.0 += 1;
match status {
@@ -557,7 +565,7 @@ impl Render for PullRequestsView {
RepoStatus::Draft => counts.3 += 1,
RepoStatus::Applied => counts.4 += 1,
}
(pr.kind == Kind::GitPullRequest && filter.matches(status)).then_some(ix)
filter.matches(status).then_some(ix)
})
.collect();
self.counts = counts;