File tree Expand file tree Collapse file tree
apps/demos/Demos/Scheduler/ResolveTimeConflicts Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -62,7 +62,6 @@ export class AppComponent {
6262 onInitialized : ( e : DxPopupTypes . InitializedEvent ) => { this . popup = e . component ; } ,
6363 onHidden : ( ) => {
6464 this . setConflictError ( false ) ;
65- this . form ?. updateData ( 'assigneeId' , [ ] ) ;
6665 } ,
6766 } ;
6867
Original file line number Diff line number Diff line change @@ -157,7 +157,6 @@ const App = () => {
157157 } ,
158158 onHidden : ( ) => {
159159 setConflictError ( false ) ;
160- formRef . current ?. updateData ( 'assigneeId' , [ ] ) ;
161160 } ,
162161 } ) , [ setConflictError ] ) ;
163162
Original file line number Diff line number Diff line change @@ -186,7 +186,6 @@ const popupOptions = {
186186 },
187187 onHidden : () => {
188188 setConflictError (false );
189- form ?.updateData (' assigneeId' , []);
190189 },
191190};
192191
Original file line number Diff line number Diff line change @@ -29,7 +29,6 @@ $(() => {
2929 } ,
3030 onHidden : ( ) => {
3131 setConflictError ( false ) ;
32- form ?. updateData ( 'assigneeId' , [ ] ) ;
3332 } ,
3433 } ,
3534 form : {
Original file line number Diff line number Diff line change @@ -441,6 +441,20 @@ describe('Appointment Form', () => {
441441 expect ( POM . popup . getInputValue ( 'roomId' ) ) . toBe ( '' ) ;
442442 } ) ;
443443
444+ it ( 'should create a new form instance on each popup opening' , async ( ) => {
445+ const { scheduler, POM } = await createScheduler ( getDefaultConfig ( ) ) ;
446+
447+ scheduler . showAppointmentPopup ( commonAppointment ) ;
448+ const firstFormInstance = POM . popup . dxForm ;
449+
450+ POM . popup . cancelButton . click ( ) ;
451+
452+ scheduler . showAppointmentPopup ( commonAppointment ) ;
453+ const secondFormInstance = POM . popup . dxForm ;
454+
455+ expect ( secondFormInstance ) . not . toBe ( firstFormInstance ) ;
456+ } ) ;
457+
444458 it ( 'should have correct repeat editor value when opening recurring appointment after common appointment' , async ( ) => {
445459 const { scheduler, POM } = await createScheduler ( getDefaultConfig ( ) ) ;
446460
Original file line number Diff line number Diff line change @@ -69,10 +69,10 @@ export class AppointmentPopup {
6969 this . state . allowSaving = config . allowSaving ;
7070 this . state . excludeInfo = config . excludeInfo ;
7171
72- if ( ! this . _popup ) {
73- const popupConfig = this . _createPopupConfig ( ) ;
74- this . _createPopup ( popupConfig ) ;
75- }
72+ this . _disposePopup ( ) ;
73+
74+ const popupConfig = this . _createPopupConfig ( ) ;
75+ this . _createPopup ( popupConfig ) ;
7676
7777 this . _popup ! . show ( ) ;
7878 }
@@ -82,9 +82,17 @@ export class AppointmentPopup {
8282 }
8383
8484 dispose ( ) {
85- this . form . dispose ( ) ;
86- this . _popup ?. dispose ( ) ;
87- this . _popup = undefined ;
85+ this . _disposePopup ( ) ;
86+ }
87+
88+ private _disposePopup ( ) : void {
89+ if ( this . _popup ) {
90+ const $element = this . _popup . $element ( ) ;
91+ this . form . dispose ( ) ;
92+ this . _popup . dispose ( ) ;
93+ $element . remove ( ) ;
94+ this . _popup = undefined ;
95+ }
8896 }
8997
9098 _createPopup ( options ) : void {
You can’t perform that action at this time.
0 commit comments