Prevent trying to set the 'maxHeight' property of the secondaryToolbar before the viewer is completely loaded

Fixes #3690.