Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#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:

ErrorCtor?

"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)

testdialog.html (1.1 KB) - added by kbenjamin 7 years ago.
testDialog2.html (1.2 KB) - added by Paul Christopher 7 years ago.

Download all attachments as: .zip

Change History (6)

Changed 7 years ago by kbenjamin

Attachment: testdialog.html added

comment:1 Changed 7 years ago by Paul Christopher

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?

Changed 7 years ago by Paul Christopher

Attachment: testDialog2.html added

comment:2 Changed 7 years ago by kbenjamin

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 7 years ago by bill

Cc: Mark Wubben added
Component: GeneralDijit
Resolution: worksforme
Status: newclosed

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 7 years ago by Mark Wubben

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.

Note: See TracTickets for help on using tickets.