Skip to content

Commit e4dd45d

Browse files
refactor: address comments.
1 parent 59c25c1 commit e4dd45d

3 files changed

Lines changed: 26 additions & 28 deletions

File tree

playwright/github-pr-drawer.spec.ts

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -712,34 +712,6 @@ test('Active PR context uses Push commit flow without creating a new pull reques
712712
},
713713
)
714714

715-
await page.route(
716-
'https://api.github.com/repos/knightedcodemonkey/develop/git/ref/**',
717-
async route => {
718-
await route.fulfill({
719-
status: 200,
720-
contentType: 'application/json',
721-
body: JSON.stringify({
722-
ref: 'refs/heads/develop/open-pr-test',
723-
object: { type: 'commit', sha: 'existing-head-sha' },
724-
}),
725-
})
726-
},
727-
)
728-
729-
await page.route(
730-
'https://api.github.com/repos/knightedcodemonkey/develop/git/ref/**',
731-
async route => {
732-
await route.fulfill({
733-
status: 200,
734-
contentType: 'application/json',
735-
body: JSON.stringify({
736-
ref: 'refs/heads/develop/open-pr-test',
737-
object: { type: 'commit', sha: 'existing-head-sha' },
738-
}),
739-
})
740-
},
741-
)
742-
743715
await page.route(
744716
'https://api.github.com/repos/knightedcodemonkey/develop/contents/**',
745717
async route => {

src/app.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,7 @@ const syncEditorPrContextIndicators = shouldShow => {
622622
}
623623

624624
icon.setAttribute('viewBox', githubPrOpenIcon.viewBox)
625+
icon.dataset.visible = shouldShow ? 'true' : 'false'
625626
icon.toggleAttribute('hidden', !shouldShow)
626627
}
627628
}
@@ -673,6 +674,11 @@ const syncAiChatTokenVisibility = token => {
673674

674675
aiChatToggle?.setAttribute('hidden', '')
675676
aiChatToggle?.setAttribute('aria-expanded', 'false')
677+
githubAiContextState.activePrContext = null
678+
githubAiContextState.activePrEditorSyncKey = ''
679+
githubAiContextState.hasSyncedActivePrEditorContent = false
680+
syncEditorPrContextIndicators(false)
681+
setGitHubPrToggleVisual('open-pr')
676682
githubPrToggle?.setAttribute('hidden', '')
677683
githubPrToggle?.setAttribute('aria-expanded', 'false')
678684
githubPrContextClose?.setAttribute('hidden', '')
@@ -817,6 +823,17 @@ prDrawerController = createGitHubPrDrawer({
817823
confirmAction(options)
818824
},
819825
onPullRequestOpened: ({ url }) => {
826+
const activeContextSyncKey = getActivePrContextSyncKey(
827+
githubAiContextState.activePrContext,
828+
)
829+
if (
830+
activeContextSyncKey &&
831+
activeContextSyncKey === githubAiContextState.activePrEditorSyncKey
832+
) {
833+
githubAiContextState.hasSyncedActivePrEditorContent = true
834+
syncEditorPrContextIndicators(true)
835+
}
836+
820837
const message = url
821838
? `Pull request opened: ${url}`
822839
: 'Pull request opened successfully.'
@@ -1415,6 +1432,10 @@ function applyRenderMode({ mode, fromActivePrContext = false }) {
14151432
renderMode.value = nextMode
14161433
}
14171434

1435+
if (fromActivePrContext === true && nextMode === 'react') {
1436+
hasAppliedReactModeDefault = true
1437+
}
1438+
14181439
resetDiagnosticsFlow()
14191440

14201441
if (

src/styles/panels-editor.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,17 @@
3131
}
3232

3333
.panel-header__sync-icon {
34+
display: none;
3435
width: 14px;
3536
height: 14px;
3637
fill: color-mix(in srgb, var(--focus-ring) 78%, var(--panel-text));
3738
opacity: 0.9;
3839
}
3940

41+
.panel-header__sync-icon[data-visible='true'] {
42+
display: inline-block;
43+
}
44+
4045
.panel-header--grid {
4146
display: grid;
4247
grid-template-columns: minmax(0, 1fr) auto;

0 commit comments

Comments
 (0)