- 
                Notifications
    
You must be signed in to change notification settings  - Fork 116
 
Fix profile change not updating target #1665
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 
          
            
          
           | 
    @@ -492,10 +492,11 @@ export class DBTCoreProjectIntegration | |||||||||||||||||||
| ); | ||||||||||||||||||||
| this.disposables.push( | ||||||||||||||||||||
| dbtProfileWatcher, | ||||||||||||||||||||
| // when the project config changes we need to re-init the dbt project | ||||||||||||||||||||
| ...setupWatcherHandler(dbtProfileWatcher, () => | ||||||||||||||||||||
| this.rebuildManifest(), | ||||||||||||||||||||
| ), | ||||||||||||||||||||
| // when the profile changes we need to refresh the project configuration | ||||||||||||||||||||
| ...setupWatcherHandler(dbtProfileWatcher, async () => { | ||||||||||||||||||||
| await this.refreshProjectConfig(); | ||||||||||||||||||||
| await this.rebuildManifest(); | ||||||||||||||||||||
| 
         
      Comment on lines
    
      +497
     to 
      +498
    
   
  
    
 | 
||||||||||||||||||||
| await this.refreshProjectConfig(); | |
| await this.rebuildManifest(); | |
| try { | |
| await this.refreshProjectConfig(); | |
| await this.rebuildManifest(); | |
| } catch (error) { | |
| console.error("Error in watcher callback:", error); | |
| this.telemetry.sendTelemetryError("watcherCallbackError", error); | |
| } | 
    
      
    
      Copilot
AI
    
    
    
      May 19, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Extract the inline async callback into a named method (e.g., handleProfileChange) to improve readability and allow direct testing of the handler logic.
| ...setupWatcherHandler(dbtProfileWatcher, async () => { | |
| await this.refreshProjectConfig(); | |
| await this.rebuildManifest(); | |
| }), | |
| ...setupWatcherHandler(dbtProfileWatcher, this.handleProfileChange.bind(this)), | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding error handling (e.g. a
try-catch) inside the async watcher callback to log or handle failures fromrefreshProjectConfigorrebuildManifest. This avoids unhandled promise rejections if one of these operations fails.