From 4708ccc7dc3005027adf11a43498a15070a26971 Mon Sep 17 00:00:00 2001 From: Paul Kaplan <pkaplan@media.mit.edu> Date: Wed, 19 Jun 2019 08:56:17 -0400 Subject: [PATCH] Be defensive about using the Wistia API --- src/components/cards/cards.jsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/cards/cards.jsx b/src/components/cards/cards.jsx index 9bb147f13..26799a861 100644 --- a/src/components/cards/cards.jsx +++ b/src/components/cards/cards.jsx @@ -104,6 +104,9 @@ class VideoStep extends React.Component { // We use the Wistia API here to update or pause the video dynamically: // https://wistia.com/support/developers/player-api componentDidUpdate (prevProps) { + // Ensure the wistia API is loaded and available + if (!(window.Wistia && window.Wistia.api)) return; + // Get a handle on the currently loaded video const video = window.Wistia.api(prevProps.video); -- GitLab