File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
apps/studio/src/lib/editor/engine/error Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 11import type { ProjectsManager } from '@/lib/projects' ;
22import { type ParsedError , compareErrors } from '@onlook/utility' ;
3- import { makeAutoObservable } from 'mobx' ;
3+ import { autorun , makeAutoObservable } from 'mobx' ;
44import type { EditorEngine } from '..' ;
55
66export class ErrorManager {
@@ -13,13 +13,23 @@ export class ErrorManager {
1313 private editorEngine : EditorEngine ,
1414 private projectsManager : ProjectsManager ,
1515 ) {
16- makeAutoObservable ( this , { } ) ;
16+ makeAutoObservable ( this ) ;
17+
18+ autorun ( ( ) => {
19+ if ( this . shouldAutoFixErrors ) {
20+ this . sendFixError ( ) ;
21+ }
22+ } ) ;
1723 }
1824
1925 get errors ( ) {
2026 return [ ...this . terminalErrors ] ;
2127 }
2228
29+ get shouldAutoFixErrors ( ) {
30+ return this . errors . length > 0 && ! this . editorEngine . chat . isWaiting ;
31+ }
32+
2333 async sendFixError ( ) {
2434 if ( this . errors . length > 0 ) {
2535 const res = await this . editorEngine . chat . sendFixErrorToAi ( this . errors ) ;
You can’t perform that action at this time.
0 commit comments