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.

Invalid render with SSR

See original GitHub issue

Hi,

I just upgraded to 2.1.1, which totally messed up the rendering of the masonry view with server-side rendering.

A simple list of images generates the following error: Warning: Prop `src` did not match. Server: "/media/bmebe50w/employee1.png?anchor=center&mode=crop&width=600&height=0&upscale=false&rnd=132526063490330000" Client: "/media/ok0mqkfl/employee2.png?anchor=center&mode=crop&width=600&height=0&upscale=false&rnd=132548434243470000"

With the following code:

const getEmployeeElement = employee => <img src={employee.imageUrl} key={employee.id}></img>


return <ResponsiveMasonry columnsCountBreakPoints={columnBreakpoints}>
    <Masonry gutter="32px" className="employees-list">
        {employees && employees.map(employee => getEmployeeElement(employee))}
    </Masonry>
 </ResponsiveMasonry>

Not just props, it could be anything. Similar issue: Expected server HTML to contain a matching <div> in <div>.

Downgrading to 2.1.0 fixed this issue.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:6
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
cedricdelpouxcommented, Nov 18, 2021

Thank you for helping @jahirfiquitiva.

I just published your fix in 2.1.4 version

1reaction
jahirfiquitivacommented, Nov 18, 2021

I’ve created a PR to fix this (#57) … I don’t know why travis build is failing, but tests are passing locally

Read more comments on GitHub >

github_iconTop Results From Across the Web

node.js - ERROR Error: invalid Server Side Rendering
I am using this commands to build and run my project in SSR mode. npm run build:ssr && npm run serve:ssr. The build...
Read more >
[SSR] Server side rendering - invalid checksum #53 - GitHub
I use this component on a page where I render on the server and then load react on the client. I'm getting this...
Read more >
react-hydration-error - Next.js
The first render is called Hydration which is a feature of React. ... Invalid HTML may cause hydration mismatch such as div inside...
Read more >
SyntaxError Invalid or unexpected token - How to SSR images ...
I'm using SSR to render a react component which should import an image. ... I get an error "SyntaxError: Invalid or unexpected token"....
Read more >
Cory House på Twitter: "To clarify, client-side React allows ...
It's caused by rendering differently on the client vs the server - in this case, due to my invalid markup. A handy safety...
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