File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -8,15 +8,24 @@ export default defineContentScript({
88 const isRepoPage = ( ) => window . location . pathname . match ( / ^ \/ [ ^ / ] + \/ [ ^ / ] + / ) ;
99
1010 // Function to manage button visibility
11+ let isCreatingButton = false ; // Flag to prevent concurrent button creation
12+
1113 const manageButton = ( ) => {
1214 const existingButton = document . getElementById ( 'git-ingest-button' ) ;
1315
1416 if ( isRepoPage ( ) ) {
15- if ( ! existingButton ) {
17+ if ( ! existingButton && ! isCreatingButton ) {
18+ isCreatingButton = true ;
1619 // Handle async operation without changing function signature
1720 createGitIngestButton ( )
18- . then ( button => appendGitIngestButton ( button ) )
19- . catch ( console . error ) ;
21+ . then ( button => {
22+ appendGitIngestButton ( button ) ;
23+ isCreatingButton = false ;
24+ } )
25+ . catch ( error => {
26+ console . error ( error ) ;
27+ isCreatingButton = false ;
28+ } ) ;
2029 }
2130 } else {
2231 existingButton ?. remove ( ) ;
You can’t perform that action at this time.
0 commit comments