From 243f6c172e7688f3c8ceb3052f094aa568c803b6 Mon Sep 17 00:00:00 2001 From: sballesteros Date: Sun, 2 Feb 2020 20:27:10 -0800 Subject: [PATCH] fix missing store init in ext --- src/components/shell-content.js | 10 ++++++---- src/stores/preprint-stores.js | 19 +++++++++---------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/components/shell-content.js b/src/components/shell-content.js index 555f7f8..c649f63 100644 --- a/src/components/shell-content.js +++ b/src/components/shell-content.js @@ -278,8 +278,9 @@ export default function ShellContent({ disabled={postProgress.isActive} error={ postProgress.body && - postProgress.body['@type'] === 'RequestForRapidPREreviewAction' && - postProgress.error + postProgress.body['@type'] === 'RequestForRapidPREreviewAction' + ? postProgress.error + : undefined } /> ) : tab === 'review' ? ( @@ -312,8 +313,9 @@ export default function ShellContent({ disabled={postProgress.isActive} error={ postProgress.body && - postProgress.body['@type'] === 'RapidPREreviewAction' && - postProgress.error + postProgress.body['@type'] === 'RapidPREreviewAction' + ? postProgress.error + : undefined } /> ) : tab === 'review#success' ? ( diff --git a/src/stores/preprint-stores.js b/src/stores/preprint-stores.js index 5f773db..5c6164e 100644 --- a/src/stores/preprint-stores.js +++ b/src/stores/preprint-stores.js @@ -94,16 +94,15 @@ export class PreprintsWithActionsStore extends EventEmitter { action['@type'] === 'RequestForRapidPREreviewAction') && getId(action.object) ) { - const preprint = this.peek(createPreprintId(action.object)); - - if (preprint) { - const nextPreprint = Object.assign({}, preprint, { - potentialAction: arrayify(preprint.potentialAction) - .filter(_action => getId(_action) !== getId(action)) - .concat(action) - }); - this.set(nextPreprint); - } + const preprint = + this.peek(createPreprintId(action.object)) || action.object; + + const nextPreprint = Object.assign({}, preprint, { + potentialAction: arrayify(preprint.potentialAction) + .filter(_action => getId(_action) !== getId(action)) + .concat(action) + }); + this.set(nextPreprint); } } }