Open joselevelsup opened 3 years ago
Experiencing the same issue
FYI - I started dynamically importing the module and it looks to be rendering properly now.
https://nextjs.org/docs/advanced-features/dynamic-import
const DiscoveryFeed = dynamic(() => import('../DiscoveryFeed'), {
ssr: true
});
@gregegan is it still working for you? Cause after a couple of refreshes (without dynamic imports), the problem I described would still occur. So I just want to make sure that with dynamic imports it works.
I got it working properly with dynamic imports, yes.....
The serverside render definitely renders different markup then the clientside... so just dynamically importing it forces it to only clientside render.
@gregegan one last thing. Have you had it working without dynamic imports? Like just have the Variants render regular components. e.g.
<Variant name="A">
<div>
//Other elements in here
</div>
</Variant>
<Variant name="B">
<div>
//Other elements in here
</div>
</Variant>
I never got it working properly without dynamic imports, I was experiencing the same issue as you.
Ah. So thats where I am stuck.
Solve it the same way. Thank you @gregegan it was the solution to use dynamic import
I created an example here: https://github.com/marvelapp/react-ab-test/tree/master/examples/next with server side rendering in NextJS. The user identifier is just a UUID stored in the current session: https://github.com/marvelapp/react-ab-test/blob/f48b4a50daf32e9facb5ae6d2588a8288d384eea/examples/next/src/pages/index.js#L31-L43 Let me know if that helps!
Table of Contents
Expected Behavior
The Experiment should render one variation and it should be displayed properly
Setup:
Current Behavior
The Experiment does render a variation but it does not render the proper elements and its children.
Outcome:
Possible Solution
Steps to Reproduce (for bugs)
sessionId
from express-session to the ExperimentuserIdentifier
propContext
I can not show different variants properly if the rendering keeps breaking.
Your Environment