File tree Expand file tree Collapse file tree
src/content-handlers/iiif/extensions/uv-openseadragon-extension Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -614,8 +614,12 @@ export default class OpenSeadragonExtension extends BaseExtension<Config> {
614614 // todo: can this be added to store?
615615 const paged = this . isPagingSettingEnabled ( ) ;
616616
617- const { downloadDialogueOpen, dialogueTriggerButton } =
618- this . store . getState ( ) as OpenSeadragonExtensionState ;
617+ // Try to initialize using the stored state; exit early if the state is not ready yet:
618+ const state : null | OpenSeadragonExtensionState = this . store . getState ( ) ;
619+ if ( state === null ) {
620+ return ;
621+ }
622+ const { downloadDialogueOpen, dialogueTriggerButton } = state as OpenSeadragonExtensionState ;
619623
620624 // todo: can the overlay visibility be added to the store?
621625 if ( downloadDialogueOpen ) {
You can’t perform that action at this time.
0 commit comments