Open aner-perez opened 6 years ago
Changing the return statement to read:
return variations[winner][0]
Fixes the issue for me but I'm not sure if this would work for all usage scenarios.
Hi @aner-perez,
Are you sure that both component-a
and component-b
contain only one root element? I'll check it for Vue 2.5.3 over the weekend. Meanwhile can you do a little check?
<template>
<split-test name="discovery-experiment">
<template slot='A' chance='3'>
<div>A</div>
<div>check</div>
</template>
<template slot='B' chance='1'>
<div>B</div>
<div>check</div>
</template>
</split-test>
</template>
I get the same error with that template.
I also get the error with this template:
<template>
<split-test name="discovery-experiment">
<template slot='A' chance='3'>
<div>A</div>
</template>
<template slot='B' chance='1'>
<div>B</div>
</template>
</split-test>
</template>
@aner-perez @softbeehive Same problem, any solution for this? If I replace the template tag by an html element the error disappears.
The components I'm outputting all have a single root element.
I was only evaluating this library and Vue at the time so I didn't get further than what was stated above. I got it to work by making the following change to the vue-a2b source code but I wasn't sure if that was the right thing to do here.
--- a/src/index.js
+++ b/src/index.js
@@ -28,7 +28,9 @@ const VueAB = {
|| randomCandidate(ctx.children)
storage.entry = {name, winner}
- return variations[winner]
+ if(variations[winner].length > 1) throw 'VueA2B Error: Only one root node allowed!'
+
+ return variations[winner][0]
}
})
Hey folks, this project is kinda abandoned. I used to support it during my time at fromAtoB
Can you recommend another library to use?
@ChadwellD Hi! I took over the maintenance of this package. I will look into this issue now. Are you still using this library or maybe another one that helps with A/B testing in Vue? I would be interested in seeing what other libraries exist.
With the following component template:
I see this error:
Looking at the render() function in src/index.js, variations[winner] is returning an Array with a single item in it which Vue does not like. I am using Vue 2.5.3.