Skip to content

Commit

Permalink
Update instrumenter.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanKolnik committed Jul 14, 2022
1 parent 2f8d6ee commit f0af160
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/instrumenter/src/instrumenter.ts
Expand Up @@ -584,10 +584,13 @@ export function instrument<TObj extends Record<string, any>>(
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__) {
Expand Down

0 comments on commit f0af160

Please sign in to comment.