Skip to content

Commit 968446e

Browse files
committed
fix: typo and queue cleanup
1 parent 7b36b18 commit 968446e

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

  • packages/scratch-gui/src/components/cards

packages/scratch-gui/src/components/cards/cards.jsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class VideoStep extends React.Component {
102102

103103
// The Wistia API doesn't provide a callback for when the video is ready,
104104
// so we use the global _wq queue that Wistia provides for this purpose.
105-
// See the below above for more details.
105+
// See the below for more details.
106106
// https://docs.wistia.com/docs/javascript-player-api#with-standard-embeds
107107
window._wq = window._wq || [];
108108
window._wq.push({
@@ -141,6 +141,10 @@ class VideoStep extends React.Component {
141141

142142
const script2 = document.getElementById('wistia-video-api');
143143
script2.parentNode.removeChild(script2);
144+
145+
// Clear the _wq queue to prevent old callbacks from firing
146+
// if the component is unmounted before the video is ready
147+
window._wq = [];
144148
}
145149

146150
render () {

0 commit comments

Comments
 (0)