From f0af160785553b0ec19314d9a12c96a662714056 Mon Sep 17 00:00:00 2001 From: Jono Kolnik <1164060+JonathanKolnik@users.noreply.github.com> Date: Thu, 14 Jul 2022 10:31:33 -0400 Subject: [PATCH] Update instrumenter.ts --- lib/instrumenter/src/instrumenter.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/instrumenter/src/instrumenter.ts b/lib/instrumenter/src/instrumenter.ts index 13b69a73851f..b0cc76c9336d 100644 --- a/lib/instrumenter/src/instrumenter.ts +++ b/lib/instrumenter/src/instrumenter.ts @@ -584,10 +584,13 @@ export function instrument>( options: Options = {} ): TObj { try { - const params = new URLSearchParams(global.window.location.search); - // Don't do any instrumentation if not loaded in an iframe and it's not running in a capture. - if (global.window.parent === global.window && !params.get('interactions')) return obj; + if (global.window.parent === global.window) { + const params = new URLSearchParams(global.window.location.search); + if (!params.get('interactions')) { + return obj; + } + } // Only create an instance if we don't have one (singleton) yet. if (!global.window.__STORYBOOK_ADDON_INTERACTIONS_INSTRUMENTER__) {