Netgen Layouts enables you to build and manage complex web pages in a simpler way and with less coding. This is the core of Netgen Layouts, its heart and soul.
The cancel method would previously dispatch a cancel event and call the close method. The close method would then dispatch another cancel event. Thus, when calling the cancel method, two cancel events would end up dispatched, leading to event handlers being called twice.
This was observed in the "Add new policy" modal dialog, where canceling fires an HTTP request to discard a draft. The first request would discard the draft successfully, but the second would fail because the draft had already been discarded.
The cancel method always calls the close method and the close method always dispatches the event. Therefore, the cancel method does not need to dispatch the event itself, instead being able to rely on the close method to do it.
The
cancel
method would previously dispatch acancel
event and call theclose
method. Theclose
method would then dispatch anothercancel
event. Thus, when calling thecancel
method, twocancel
events would end up dispatched, leading to event handlers being called twice.This was observed in the "Add new policy" modal dialog, where canceling fires an HTTP request to discard a draft. The first request would discard the draft successfully, but the second would fail because the draft had already been discarded.
The
cancel
method always calls theclose
method and theclose
method always dispatches the event. Therefore, thecancel
method does not need to dispatch the event itself, instead being able to rely on theclose
method to do it.