Instantiate dialog only if it's active.

Otherwise, dialogs that do stuff with their modal data when they're opened (other than using it in a template) will fail.