Skip to content

Server side rendering broken in 2.7 #1276

Description

@tf

Steps to reproduce

Render any component with prerender: true.

I've created this sample Rails app to reproduce the issue:
https://github.com/tf/react-rails-2-7-ssr-bug

Expected behavior

HTML is generated.

Actual behavior

Server side executed JS causes:

TypeError: Cannot read properties of undefined (reading 'version')

System configuration

  • Sprockets version: 4.2
  • React-Rails version: 2.7
  • Rect_UJS version: ?
  • Rails version: 7
  • Ruby version: 2.7

Probably caused by this line: https://github.com/reactjs/react-rails/pull/1269/files#diff-46071864dd030eabbafccec157424caade6e2c3b0f30ebaf9f4fd3f224377216R3

Maybe ReactDOM is not present in server context?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions