From 0b2b7fff929e04433a7da214340425a87f444e9c Mon Sep 17 00:00:00 2001 From: Travis Eden Date: Mon, 12 Nov 2018 10:20:41 -0500 Subject: [PATCH 1/2] return null if either requestId or requestType are undefined --- server/render/build/handleShowRender.js | 4 ++++ server/render/src/handleShowRender.jsx | 3 +++ 2 files changed, 7 insertions(+) diff --git a/server/render/build/handleShowRender.js b/server/render/build/handleShowRender.js index 277b9630..536b431b 100644 --- a/server/render/build/handleShowRender.js +++ b/server/render/build/handleShowRender.js @@ -44,6 +44,10 @@ var getCanonicalUrlFromShow = function getCanonicalUrlFromShow(show) { var requestId = show.requestList[show.request.id]; var requestType = show.request.type; + if (!requestId || !requestType) { + return null; + } + switch (requestType) { case 'ASSET_DETAILS': var asset = show.assetList[requestId.key]; diff --git a/server/render/src/handleShowRender.jsx b/server/render/src/handleShowRender.jsx index a0640ffa..d6ce7c95 100644 --- a/server/render/src/handleShowRender.jsx +++ b/server/render/src/handleShowRender.jsx @@ -20,6 +20,9 @@ const createCanonicalLink = require('../../../utils/createCanonicalLink'); const getCanonicalUrlFromShow = show => { const requestId = show.requestList[show.request.id]; const requestType = show.request.type; + if (!requestId || !requestType) { + return null; + } switch (requestType) { case 'ASSET_DETAILS': const asset = show.assetList[requestId.key]; From eea5d67f02b184a8c2dc414309ae8ea4e79065cf Mon Sep 17 00:00:00 2001 From: Shawn K Date: Mon, 12 Nov 2018 10:19:31 -0600 Subject: [PATCH 2/2] Update handleShowRender.jsx --- server/render/src/handleShowRender.jsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/render/src/handleShowRender.jsx b/server/render/src/handleShowRender.jsx index d6ce7c95..6e527b0c 100644 --- a/server/render/src/handleShowRender.jsx +++ b/server/render/src/handleShowRender.jsx @@ -20,9 +20,11 @@ const createCanonicalLink = require('../../../utils/createCanonicalLink'); const getCanonicalUrlFromShow = show => { const requestId = show.requestList[show.request.id]; const requestType = show.request.type; + if (!requestId || !requestType) { return null; } + switch (requestType) { case 'ASSET_DETAILS': const asset = show.assetList[requestId.key]; @@ -39,6 +41,7 @@ const returnSagaWithParams = (saga, params) => { yield call(saga, params); }; }; + module.exports = (req, res) => { let context = {}; @@ -54,6 +57,7 @@ module.exports = (req, res) => { // Workaround, remove when a solution for async httpContext exists const showState = store.getState().show; const assetKeys = Object.keys(showState.assetList); + if(assetKeys.length !== 0) { res.claimId = showState.assetList[assetKeys[0]].claimId; } else {