question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Table of Contents

Expected Behavior

The Experiment should render one variation and it should be displayed properly

Setup:

<Experiment name="An Experiment" userIdentifier={this.props.sessionId}> - sessionId comes from express-session
  <Variant name="Variation A">
    <div>
     {children} - children here represent actual elements not like a parent Component
    </div>
  </Variant>
  <Variant name="Variation B">
    <div>
     {children} - children here represent actual elements not like a parent Component
    </div>
  </Variant>
</Experiment>

Current Behavior

The Experiment does render a variation but it does not render the proper elements and its children.

Outcome:

{/* Rendered Properly */}
<div className="class">
 <p className="class-p">
  Hello P
</p>
 <p className="class-pd">
  Hello PD
</p>
</div>

{/* Current Results */}
<div className="class">
 <p className="class-p">
  Hello PD
</p>
 <p className="class-pd">
  Hello P
</p>
</div>

Possible Solution

Steps to Reproduce (for bugs)

  1. Start a new nextjs project
  2. Make a new Experiment in a page
  3. Add the sessionId from express-session to the Experiment userIdentifier prop
  4. See the results

Context

I can not show different variants properly if the rendering keeps breaking.

Your Environment

  • Version used: 2.3.0
  • Browser Name and version: Chrome 86.0.4240.75 or Firefox 81
  • Operating System and version (desktop or mobile): Manjaro
  • Link to your project: Can not provide.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:3
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
MauricioParadaGcommented, Feb 19, 2021

Solve it the same way. Thank you @gregegan it was the solution to use dynamic import

0reactions
moretticommented, May 29, 2021

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!

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is Rendering? - How Next.js Works
With Next.js, three types of rendering methods are available: Server-Side Rendering, Static Site Generation, and Client-Side Rendering. Pre-Rendering.
Read more >
Basic Features: Pages - Next.js
Next.js has two forms of pre-rendering: Static Generation and Server-side Rendering. The difference is in when it generates the HTML for a page....
Read more >
Pre-rendering and Data Fetching | Learn Next.js
Next.js ' pre-rendering feature. The two forms of pre-rendering: Static Generation and Server-side Rendering. Static Generation with data, and without data.
Read more >
Rendering Strategies - Rendering and Ranking | Learn Next.js
Client Side Rendering (CSR). Client-Side Rendering allows developers to make their websites entirely rendered in the browser with JavaScript. On initial page ...
Read more >
Two Forms of Pre-rendering - Pre-rendering and Data Fetching
Next.js has two forms of pre-rendering: Static Generation and Server-side Rendering. The difference is in when it generates the HTML for a page....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found