Skip to content

Commit

Permalink
add comment and sanitize resoluction property and return after replac…
Browse files Browse the repository at this point in the history
…e url
  • Loading branch information
FentPams committed Aug 13, 2024
1 parent 430ef17 commit 5bc6727
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions plugins/experimentation/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,13 +372,14 @@ function createModificationsHandler(
const url = await getExperienceUrl(ns.config);
let res;
if (url && new URL(url, window.location.origin).pathname !== window.location.pathname) {
if (metadata?.resolution === 'redirect') {
if (toClassName(metadata?.resolution) === 'redirect') {
// Firing RUM event early since redirection will stop the rest of the JS execution
fireRUM(type, config, pluginOptions, url);
window.location.replace(url);
} else {
// eslint-disable-next-line no-await-in-loop
res = await replaceInner(new URL(url, window.location.origin).pathname, el);
return null;
}
// eslint-disable-next-line no-await-in-loop
res = await replaceInner(new URL(url, window.location.origin).pathname, el);
} else {
res = url;
}
Expand Down

0 comments on commit 5bc6727

Please sign in to comment.