Skip to content

Commit

Permalink
default config.raise_on_prerender_error = Rails.env.development? (#1145)
Browse files Browse the repository at this point in the history
* Update configuration.md
* Changed default for raise_on_prerender_error

Now set to raise during development.
  config.raise_on_prerender_error = Rails.env.development?
  • Loading branch information
justin808 authored Dec 6, 2018
1 parent aa7060f commit 1f8d513
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 9 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ Changes since last non-beta release.

- Enabled the use of webpack-dev-server with Server-side rendering. (https://github.com/shakacode/react_on_rails/pull/1173) by [justin808](https://github.com/justin808) and [judahmeek](https://github.com/judahmeek).

#### Changed
- Changed the default for:
```rb
config.raise_on_prerender_error = Rails.env.development?
```

Thus, developers will need to fix server rendering errors before continuing.
[PR 1145](https://github.com/shakacode/react_on_rails/pull/1145) by [justin808](https://github.com/justin808).

### [11.1.8] - 2018-10-14

#### Improved
Expand Down
14 changes: 9 additions & 5 deletions docs/api/view-helpers-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,18 @@ Once the bundled files have been generated in your `app/assets/webpack` folder a
```ruby
react_component(component_name,
props: {},
prerender: nil,
trace: nil,
replay_console: nil,
raise_on_prerender_error: nil,
id: nil,
prerender: nil)
html_options: {})
```

Uncommonly used options:
```
trace: nil,
replay_console: nil,
raise_on_prerender_error: nil,
id: nil,
```

- **component_name:** Can be a React component, created using an ES6 class or a generator function that returns a React component (or, only on the server side, an object with shape { redirectLocation, error, renderedHtml }), or a "renderer function" that manually renders a React component to the dom (client side only).
All options except `props, id, html_options` will inherit from your `react_on_rails.rb` initializer, as described [here](../basics/configuration.md).
- **general options:**
Expand Down
7 changes: 4 additions & 3 deletions docs/basics/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,11 @@ ReactOnRails.configure do |config|
#
config.logging_on_server = true

# Default is to false to NOT raise exception on server if the JS code throws.
# Reason is that it's easier to debug this when you get the error over to the client.
# Default is true only for development? to raise exception on server if the JS code throws for
# server rendering. The reason is that the server logs will show the error and force you to fix
# any server rendering issues immediately during development.
#
config.raise_on_prerender_error = false
config.raise_on_prerender_error = Rails.env.development?

################################################################################
# Server Renderer Configuration for ExecJS
Expand Down
2 changes: 1 addition & 1 deletion lib/react_on_rails/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def self.configuration
prerender: false,
replay_console: true,
logging_on_server: true,
raise_on_prerender_error: false,
raise_on_prerender_error: Rails.env.development?,
trace: Rails.env.development?,
development_mode: Rails.env.development?,
server_renderer_pool_size: DEFAULT_POOL_SIZE,
Expand Down

0 comments on commit 1f8d513

Please sign in to comment.