@@ -70,7 +70,6 @@ export class LineageView extends TextFileView {
7070 id : string ;
7171 zoomFactor : number ;
7272 minimapDom : MinimapDomElements | null = null ;
73- private hasDebouncedSave = false ;
7473 private readonly onDestroyCallbacks : Set < Unsubscriber > = new Set ( ) ;
7574 private activeFilePath : null | string ;
7675 constructor (
@@ -121,16 +120,11 @@ export class LineageView extends TextFileView {
121120 this . loadInitialData ( ) ;
122121 } else {
123122 this . data = data ;
124- this . debouncedLoadDocumentToStore ( ) ;
123+ if ( this . isViewOfFile ) this . debouncedLoadDocumentToStore ( ) ;
125124 }
126125 }
127126
128127 async onUnloadFile ( ) {
129- if ( this . hasDebouncedSave && this . data . length ) {
130- this . save ( ) ;
131- this . hasDebouncedSave = false ;
132- }
133-
134128 if ( this . component ) {
135129 this . component . $destroy ( ) ;
136130 }
@@ -191,7 +185,7 @@ export class LineageView extends TextFileView {
191185 onPluginError ( error , location , action ) ;
192186 } ;
193187
194- saveDocument = async ( debounced = false ) => {
188+ saveDocument = async ( ) => {
195189 invariant ( this . file ) ;
196190 const state = clone ( this . documentStore . getValue ( ) ) ;
197191 const data : string =
@@ -202,25 +196,10 @@ export class LineageView extends TextFileView {
202196 throw new Error ( lang . error_save_empty_data ) ;
203197 }
204198 this . data = data ;
205- if ( debounced ) {
206- this . debouncedSave ( ) ;
207- } else {
208- this . requestSave ( ) ;
209- }
210- this . hasDebouncedSave = debounced ;
199+ this . requestSave ( ) ;
211200 }
212201 } ;
213202
214- private debouncedSave = debounce (
215- ( ) => {
216- if ( ! this . hasDebouncedSave ) return ;
217- this . save ( ) ;
218- this . hasDebouncedSave = false ;
219- } ,
220- 8000 ,
221- true ,
222- ) ;
223-
224203 private loadInitialData = async ( ) => {
225204 invariant ( this . file ) ;
226205
0 commit comments