11import { AfterViewInit , Component , OnDestroy , OnInit , ViewChild } from '@angular/core' ;
22import { ActivatedRoute } from '@angular/router' ;
33import { catchError , debounceTime , EMPTY , filter , firstValueFrom , skip , Subject , switchMap , takeUntil , tap } from 'rxjs' ;
4+ import { C_E_AUTOSAVE_DEBOUNCE_MS } from '../constants' ;
45import {
56 ComplianceAndEnforcementDto ,
67 InitialSubmissionType ,
@@ -90,7 +91,7 @@ export class DraftComponent implements OnInit, AfterViewInit, OnDestroy {
9091 this . initialSubmissionType = overview . initialSubmissionType ;
9192 }
9293 } ) ,
93- debounceTime ( 1000 ) ,
94+ debounceTime ( C_E_AUTOSAVE_DEBOUNCE_MS ) ,
9495 switchMap ( ( overview ) =>
9596 this . file ?. uuid ? this . complianceAndEnforcementService . update ( this . file . uuid , overview ) : EMPTY ,
9697 ) ,
@@ -108,7 +109,7 @@ export class DraftComponent implements OnInit, AfterViewInit, OnDestroy {
108109 this . submitterComponent . $changes
109110 . pipe (
110111 skip ( 1 ) , // Skip the initial emission to prevent save on load
111- debounceTime ( 1000 ) ,
112+ debounceTime ( C_E_AUTOSAVE_DEBOUNCE_MS ) ,
112113 switchMap ( ( submitter ) =>
113114 this . submitter ?. uuid
114115 ? this . complianceAndEnforcementSubmitterService . update ( this . submitter . uuid , submitter )
@@ -133,7 +134,7 @@ export class DraftComponent implements OnInit, AfterViewInit, OnDestroy {
133134 this . propertyComponent . $changes
134135 . pipe (
135136 skip ( 1 ) , // Skip the initial emission to prevent save on load
136- debounceTime ( 1000 ) ,
137+ debounceTime ( C_E_AUTOSAVE_DEBOUNCE_MS ) ,
137138 filter ( ( ) => this . propertyComponent ?. form . dirty ?? false ) ,
138139 switchMap ( ( property ) => {
139140 // Only auto-save if there are meaningful changes (non-empty fields)
0 commit comments