File tree Expand file tree Collapse file tree
packages/client-runtime/src/state Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -226,6 +226,22 @@ describe("applyShellStreamEvent", () => {
226226 expect ( afterEnrichment . threads [ 0 ] ?. title ) . toBe ( "Server thread" ) ;
227227 } ) ;
228228
229+ it ( "keeps the project object when an enrichment re-resolves an unchanged identity" , ( ) => {
230+ const project = { ...v2Project , repositoryIdentity } ;
231+ const previous = { ...v2ShellSnapshot , snapshotSequence : 5 , projects : [ project ] } ;
232+ const next = mergeShellSnapshotProjects (
233+ previous ,
234+ {
235+ ...v2ShellSnapshot ,
236+ snapshotSequence : 5 ,
237+ projects : [ { ...v2Project , repositoryIdentity : { ...repositoryIdentity } } ] ,
238+ } ,
239+ { resolvedRepositoryIdentityRoots : [ v2Project . workspaceRoot ] } ,
240+ ) ;
241+
242+ expect ( next . projects [ 0 ] ) . toBe ( project ) ;
243+ } ) ;
244+
229245 it ( "takes identity from a lower-sequence enrichment without reverting live thread state" , ( ) => {
230246 const previous = {
231247 ...v2ShellSnapshot ,
Original file line number Diff line number Diff line change 11import {
22 OrchestrationV2ThreadShell ,
3+ RepositoryIdentity ,
34 ThreadPullRequestLink ,
45 type OrchestrationProjectShell ,
56 type OrchestrationV2ShellSnapshot ,
@@ -9,6 +10,9 @@ import * as Schema from "effect/Schema";
910
1011const sameThreadShell = Schema . toEquivalence ( OrchestrationV2ThreadShell ) ;
1112const sameLinks = Schema . toEquivalence ( Schema . UndefinedOr ( Schema . Array ( ThreadPullRequestLink ) ) ) ;
13+ const sameRepositoryIdentity = Schema . toEquivalence (
14+ Schema . UndefinedOr ( Schema . NullOr ( RepositoryIdentity ) ) ,
15+ ) ;
1216
1317export function sameThreadPullRequests (
1418 left : OrchestrationV2ThreadShell [ "pullRequests" ] ,
@@ -96,6 +100,11 @@ export function mergeShellSnapshotProjects(
96100 return project ;
97101 }
98102 if ( resolvedRootSet ?. has ( project . workspaceRoot ) === true ) {
103+ // Refreshes re-resolve every root; an unchanged identity keeps the project's identity
104+ // so every subscriber (each pull request row, the sidebar) skips re-rendering.
105+ if ( sameRepositoryIdentity ( project . repositoryIdentity , candidate . repositoryIdentity ) ) {
106+ return project ;
107+ }
99108 return { ...project , repositoryIdentity : candidate . repositoryIdentity } ;
100109 }
101110 if ( project . repositoryIdentity == null && candidate . repositoryIdentity != null ) {
You can’t perform that action at this time.
0 commit comments