#15916 closed defect (worksforme)
Timing problems in show / hide in dijit/Dialog - possibly an issue with Dialog, Deferred or fx
Reported by: | kbenjamin | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | tbd |
Component: | Dijit | Version: | 1.8.0 |
Keywords: | Cc: | Mark Wubben | |
Blocked By: | Blocking: |
Description
I'm not sure if this is a problem with Deferred, fx, or specific to dijit/Dialog.
If you show() a Dialog and then hide() it again before the previous animation has completed an error is thrown:
"Error
at Error (unknown source) at new ErrorCtor? (http://localhost:88/ii/dojo/errors/create.js:13:21) at dojo.Deferred.promise.cancel.cancel (http://localhost:88/ii/dojo/_base/Deferred.js:309:15) at declare.hide (http://localhost:88/ii/dijit/Dialog.js:414:26) at broken (http://localhost:88/ii/testdialog.html:31:11) at http://localhost:88/ii/testdialog.html:25:67"
If you add enough delay before hiding to ensure that the animations have completed, no error is thrown.
Looking at the code for Dialog, it appears to attempt to cancel the show() animation before starting the hide() but that cancellation seems to arrive too late (my interpretation of what is happening).
I have built a simple test case to show what happens in both scenarios.
Attachments (2)
Change History (6)
Changed 8 years ago by
Attachment: | testdialog.html added |
---|
comment:1 Changed 8 years ago by
Changed 8 years ago by
Attachment: | testDialog2.html added |
---|
comment:2 Changed 8 years ago by
Thanks, Paul, you are correct about the logging of errors. I hadn't realized that and it left me chasing this ghost.
Let's close the ticket.
comment:3 Changed 8 years ago by
Cc: | Mark Wubben added |
---|---|
Component: | General → Dijit |
Resolution: | → worksforme |
Status: | new → closed |
Yeah I wish there was a way to avoid that "error" logging for cases that like this that aren't errors, but I don't know a good way.
comment:4 Changed 8 years ago by
The instrumentation can't really differentiate. Even checking if the error is a CancelError? may give false results since it could have bubbled from a different deferred. In these circumstances usually the best solution is to handle rejection yourself and only rethrow if it's an unexpected error.
Showing and hiding a dialog works for me without any error, see testDialog2.html.
Adding "useDeferredInstrumentation:true" to the data-dojo-config indeed gives an error but still the dialog is shown/hidden as expected. Isn't it the job of "useDeferredInstrumentation:true" to throw errors on cancelation?