diff --git a/sib-notifications.js b/sib-notifications.js index 6d915dbcfa9fecfa6e58d86aba9a93d3897edcc7..c8d458e7540133ea8db7638c3034c7880ab68ca6 100644 --- a/sib-notifications.js +++ b/sib-notifications.js @@ -81,13 +81,16 @@ class SIBNotifications extends SIBTemplateElement { } _onClickNotification(target) { + let extraContext = {} if (this.props.extraContext) { - const context = { ...target.context, ...JSON.parse(this.props.extraContext) } - store.get(target.resource.object, context).then((resource) => { - window.dispatchEvent(new CustomEvent('requestNavigation', { detail: { resource: resource } })) - this.querySelector('details').removeAttribute("open") - }) + extraContext = JSON.parse(this.props.extraContext) } + const context = { ...target.context, ...extraContext } + store.get(target.resource.object, context).then((resource) => { + if (!resource) return; + window.dispatchEvent(new CustomEvent('requestNavigation', { detail: { resource: resource } })) + this.querySelector('details').removeAttribute("open") + }) } _onClickUnreadButton(target) { this._onReadResource(target.closest('sib-display').resource['@id'])