Skip to content

Commit a69c7bd

Browse files
refactor: address pr comments.
1 parent 036d919 commit a69c7bd

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

src/app.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -837,13 +837,20 @@ const githubWorkflows = createGitHubWorkflowsSetup({
837837
prContextUi,
838838
onPrContextStateChange: activeContext => {
839839
if (activeContext?.prTitle) {
840-
setWorkspacePrContextState('active')
841-
setWorkspacePrNumber(
840+
const nextPrNumber =
842841
toPullRequestNumber(activeContext.pullRequestNumber) ??
843-
parsePullRequestNumberFromUrl(activeContext.pullRequestUrl),
844-
)
842+
parsePullRequestNumberFromUrl(activeContext.pullRequestUrl)
843+
const shouldPersistPrContext =
844+
workspacePrContextState !== 'active' || workspacePrNumber !== nextPrNumber
845+
846+
setWorkspacePrNumber(nextPrNumber)
847+
848+
if (shouldPersistPrContext) {
849+
persistWorkspacePrContextState('active')
850+
}
845851
} else if (workspacePrContextState === 'active') {
846-
setWorkspacePrContextState('inactive')
852+
setWorkspacePrNumber(null)
853+
persistWorkspacePrContextState('inactive')
847854
}
848855
editedIndicatorVisibilityController.refreshIndicators()
849856
},

0 commit comments

Comments
 (0)