react_on_rails 16.2.0.beta.3 → 16.2.0.beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +18 -0
  3. data/CLAUDE.md +59 -0
  4. data/CONTRIBUTING.md +48 -0
  5. data/Gemfile.development_dependencies +1 -0
  6. data/Gemfile.lock +25 -2
  7. data/SWITCHING_CI_CONFIGS.md +55 -6
  8. data/Steepfile +51 -0
  9. data/bin/ci-rerun-failures +34 -11
  10. data/bin/ci-run-failed-specs +25 -1
  11. data/bin/ci-switch-config +254 -32
  12. data/bin/lefthook/check-trailing-newlines +2 -12
  13. data/bin/lefthook/eslint-lint +0 -10
  14. data/bin/lefthook/prettier-format +0 -10
  15. data/bin/lefthook/ruby-autofix +1 -5
  16. data/lib/react_on_rails/configuration.rb +56 -12
  17. data/lib/react_on_rails/controller.rb +3 -3
  18. data/lib/react_on_rails/doctor.rb +4 -2
  19. data/lib/react_on_rails/helper.rb +3 -3
  20. data/lib/react_on_rails/pro_helper.rb +2 -44
  21. data/lib/react_on_rails/react_component/render_options.rb +7 -7
  22. data/lib/react_on_rails/utils.rb +40 -0
  23. data/lib/react_on_rails/version.rb +1 -1
  24. data/react_on_rails_pro/CHANGELOG.md +135 -29
  25. data/react_on_rails_pro/Gemfile.development_dependencies +1 -0
  26. data/react_on_rails_pro/Gemfile.lock +6 -3
  27. data/react_on_rails_pro/README.md +559 -38
  28. data/react_on_rails_pro/docs/installation.md +40 -22
  29. data/react_on_rails_pro/docs/node-renderer/basics.md +26 -19
  30. data/react_on_rails_pro/docs/node-renderer/js-configuration.md +24 -22
  31. data/react_on_rails_pro/docs/node-renderer/troubleshooting.md +2 -0
  32. data/react_on_rails_pro/lib/react_on_rails_pro/version.rb +1 -1
  33. data/react_on_rails_pro/package.json +1 -1
  34. data/react_on_rails_pro/packages/node-renderer/src/master/restartWorkers.ts +39 -17
  35. data/react_on_rails_pro/packages/node-renderer/src/master.ts +15 -4
  36. data/react_on_rails_pro/packages/node-renderer/src/shared/configBuilder.ts +44 -5
  37. data/react_on_rails_pro/packages/node-renderer/src/shared/utils.ts +4 -2
  38. data/react_on_rails_pro/packages/node-renderer/src/worker/handleGracefulShutdown.ts +49 -0
  39. data/react_on_rails_pro/packages/node-renderer/src/worker/vm.ts +3 -3
  40. data/react_on_rails_pro/packages/node-renderer/src/worker.ts +5 -2
  41. data/react_on_rails_pro/packages/node-renderer/tests/helper.ts +8 -8
  42. data/react_on_rails_pro/packages/node-renderer/tests/testingNodeRendererConfigs.js +1 -1
  43. data/react_on_rails_pro/packages/node-renderer/tests/worker.test.ts +19 -19
  44. data/react_on_rails_pro/rakelib/rbs.rake +47 -0
  45. data/react_on_rails_pro/sig/react_on_rails_pro/cache.rbs +13 -0
  46. data/react_on_rails_pro/sig/react_on_rails_pro/configuration.rbs +100 -0
  47. data/react_on_rails_pro/sig/react_on_rails_pro/error.rbs +4 -0
  48. data/react_on_rails_pro/sig/react_on_rails_pro/utils.rbs +7 -0
  49. data/react_on_rails_pro/sig/react_on_rails_pro.rbs +5 -0
  50. data/react_on_rails_pro/spec/dummy/Gemfile.lock +6 -3
  51. data/react_on_rails_pro/spec/dummy/client/node-renderer.js +1 -1
  52. data/react_on_rails_pro/spec/dummy/spec/system/integration_spec.rb +16 -17
  53. data/sig/react_on_rails/controller.rbs +1 -1
  54. data/sig/react_on_rails/error.rbs +4 -0
  55. data/sig/react_on_rails/helper.rbs +2 -2
  56. data/sig/react_on_rails/json_parse_error.rbs +10 -0
  57. data/sig/react_on_rails/prerender_error.rbs +21 -0
  58. data/sig/react_on_rails/smart_error.rbs +28 -0
  59. data/sig/react_on_rails.rbs +3 -24
  60. metadata +14 -3
  61. data/lib/react_on_rails/pro_utils.rb +0 -37
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "react_on_rails/utils"
4
- require "react_on_rails/pro_utils"
5
4
 
6
5
  module ReactOnRails
7
6
  module ReactComponent
@@ -15,13 +14,10 @@ module ReactOnRails
15
14
  # TODO: remove the required for named params
16
15
  def initialize(react_component_name: required("react_component_name"), options: required("options"))
17
16
  @react_component_name = react_component_name.camelize
18
-
19
- result = ReactOnRails::ProUtils.disable_pro_render_options_if_not_licensed(options)
20
- @options = result[:raw_options]
21
- @explicitly_disabled_pro_options = result[:explicitly_disabled_pro_options]
17
+ @options = options
22
18
  end
23
19
 
24
- attr_reader :react_component_name, :explicitly_disabled_pro_options
20
+ attr_reader :react_component_name
25
21
 
26
22
  def throw_js_errors
27
23
  options.fetch(:throw_js_errors, false)
@@ -100,7 +96,11 @@ module ReactOnRails
100
96
  end
101
97
 
102
98
  def immediate_hydration
103
- retrieve_configuration_value_for(:immediate_hydration)
99
+ ReactOnRails::Utils.normalize_immediate_hydration(
100
+ options[:immediate_hydration],
101
+ react_component_name,
102
+ "Component"
103
+ )
104
104
  end
105
105
 
106
106
  def to_s
@@ -14,6 +14,46 @@ module ReactOnRails
14
14
  Rainbow('To see the full output, set FULL_TEXT_ERRORS=true.').red
15
15
  } ...\n".freeze
16
16
 
17
+ def self.immediate_hydration_pro_license_warning(name, type = "Component")
18
+ "[REACT ON RAILS] Warning: immediate_hydration: true requires a React on Rails Pro license.\n" \
19
+ "#{type} '#{name}' will fall back to standard hydration behavior.\n" \
20
+ "Visit https://www.shakacode.com/react-on-rails-pro/ for licensing information."
21
+ end
22
+
23
+ # Normalizes the immediate_hydration option value, enforcing Pro license requirements.
24
+ # Returns the normalized boolean value for immediate_hydration.
25
+ #
26
+ # @param value [Boolean, nil] The immediate_hydration option value
27
+ # @param name [String] The name of the component/store (for warning messages)
28
+ # @param type [String] The type ("Component" or "Store") for warning messages
29
+ # @return [Boolean] The normalized immediate_hydration value
30
+ # @raise [ArgumentError] If value is not a boolean or nil
31
+ #
32
+ # Logic:
33
+ # - Validates that value is true, false, or nil
34
+ # - If value is explicitly true (boolean) and no Pro license: warn and return false
35
+ # - If value is nil: return true for Pro users, false for non-Pro users
36
+ # - Otherwise: return the value as-is (allows explicit false to work)
37
+ def self.normalize_immediate_hydration(value, name, type = "Component")
38
+ # Type validation: only accept boolean or nil
39
+ unless [true, false, nil].include?(value)
40
+ raise ArgumentError,
41
+ "[REACT ON RAILS] immediate_hydration must be true, false, or nil. Got: #{value.inspect} (#{value.class})"
42
+ end
43
+
44
+ # Strict equality check: only trigger warning for explicit boolean true
45
+ if value == true && !react_on_rails_pro?
46
+ Rails.logger.warn immediate_hydration_pro_license_warning(name, type)
47
+ return false
48
+ end
49
+
50
+ # If nil, default based on Pro license status
51
+ return react_on_rails_pro? if value.nil?
52
+
53
+ # Return explicit value (including false)
54
+ value
55
+ end
56
+
17
57
  # https://forum.shakacode.com/t/yak-of-the-week-ruby-2-4-pathname-empty-changed-to-look-at-file-size/901
18
58
  # return object if truthy, else return nil
19
59
  def self.truthy_presence(obj)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ReactOnRails
4
- VERSION = "16.2.0.beta.3"
4
+ VERSION = "16.2.0.beta.4"
5
5
  end
@@ -1,7 +1,9 @@
1
1
  # Change Log
2
+
2
3
  All notable changes to this project will be documented in this file. Items under `Unreleased` is upcoming features that will be out in next release.
3
4
 
4
5
  ## Gem and Package Versions
6
+
5
7
  Gem and package versions are the same except for beta releases where the gem uses a `.beta` and the package uses a `-beta` (same for `rc`).
6
8
 
7
9
  1. **Gem**: `3.0.0.rc.1`
@@ -9,54 +11,69 @@ Gem and package versions are the same except for beta releases where the gem use
9
11
 
10
12
  You can find the **package** version numbers from this repo's tags and below in this file.
11
13
 
12
- ----
14
+ ---
13
15
 
14
16
  [HEAD compared to 3.3.1]: Click to see all changes compared to the last 3.x version. See the [4.0 Release Notes](https://github.com/shakacode/react_on_rails_pro/blob/master/docs/release-notes/4.0.md).
15
17
 
16
18
  ## [Unreleased]
17
- *Add changes in master not yet tagged.*
19
+
20
+ _Add changes in master not yet tagged._
18
21
 
19
22
  ### Added
23
+
20
24
  - Added `cached_stream_react_component` helper method, similar to `cached_react_component` but for streamed components.
21
25
  - **License Validation System**: Implemented comprehensive JWT-based license validation with offline verification using RSA-256 signatures. License validation occurs at startup in both Ruby and Node.js environments. Supports required fields (`sub`, `iat`, `exp`) and optional fields (`plan`, `organization`, `iss`). FREE evaluation licenses are available for 3 months at [shakacode.com/react-on-rails-pro](https://shakacode.com/react-on-rails-pro). [PR #1857](https://github.com/shakacode/react_on_rails/pull/1857) by [AbanoubGhadban](https://github.com/AbanoubGhadban).
22
26
  - **Pro-Specific Configurations Moved from Open-Source**: The following React Server Components (RSC) configurations are now exclusively in the Pro gem and should be configured in `ReactOnRailsPro.configure`:
27
+
23
28
  - `rsc_bundle_js_file` - Path to the RSC bundle file
24
29
  - `react_server_client_manifest_file` - Path to the React server client manifest
25
30
  - `react_client_manifest_file` - Path to the React client manifest
26
31
 
27
32
  These configurations were previously available in the open-source `ReactOnRails.configure` block but have been moved to Pro where they belong since RSC is a Pro-only feature.
33
+
28
34
  - **Streaming View Helpers Now Pro-Exclusive**: The following view helpers are now defined exclusively in the Pro gem:
35
+
29
36
  - `stream_react_component` - Progressive SSR using React 18+ streaming
30
37
  - `rsc_payload_react_component` - RSC payload rendering
31
38
 
32
39
  These helpers were previously in the open-source gem but have been moved to Pro as they are Pro-only features.
40
+
33
41
  - **Node Renderer Gem Version Validation**: The node renderer now validates that the Ruby gem version (`react_on_rails_pro`) matches the node renderer package version (`@shakacode-tools/react-on-rails-pro-node-renderer`) on every render request. Environment-aware: strict enforcement in development (returns 412 Precondition Failed on mismatch), permissive in production (allows with warning). Includes version normalization to handle Ruby gem vs NPM format differences (e.g., `4.0.0.rc.1` vs `4.0.0-rc.1`). [PR #1881](https://github.com/shakacode/react_on_rails/pull/1881) by [AbanoubGhadban](https://github.com/AbanoubGhadban).
34
42
 
43
+ ### Changed
44
+
45
+ - Renamed Node Renderer configuration option `bundlePath` to `serverBundleCachePath` to better clarify its purpose as a cache directory for uploaded server bundles, distinct from Shakapacker's public asset directory. The old `bundlePath` property and `RENDERER_BUNDLE_PATH` environment variable continue to work with deprecation warnings. [PR 2008](https://github.com/shakacode/react_on_rails/pull/2008) by [justin808](https://github.com/justin808).
46
+
35
47
  ### Changed (Breaking)
48
+
36
49
  - `config.prerender_caching`, which controls caching for non-streaming components, now also controls caching for streamed components. To disable caching for an individual render, pass `internal_option(:skip_prerender_cache)`.
37
50
  - **Configuration Migration Required**: If you are using RSC features, you must move the RSC-related configurations from `ReactOnRails.configure` to `ReactOnRailsPro.configure` in your initializers. See the migration example in the [React on Rails CHANGELOG](https://github.com/shakacode/react_on_rails/blob/master/CHANGELOG.md#unreleased).
38
51
 
39
52
  ## [4.0.0-rc.15] - 2025-08-11
40
53
 
41
54
  ### Fixed
55
+
42
56
  - Fixed an issue where, when React Server Components (RSC) support was disabled, the Node Renderer unnecessarily requested bundles on every render. Now, bundles are only requested when actually needed, improving performance and reducing redundant network traffic. [PR 545](https://github.com/shakacode/react_on_rails_pro/pull/545) by [AbanoubGhadban](https://github.com/AbanoubGhadban).
57
+ - **Fix `descriptor closed` error**: The errors happens when the node renderer restarts while it's still handling an in-progress request (especially if it's a streaming request that may take more time to handle). Implemented a fix that makes worker shutdown gracefully after it finishes all active requests. When a worker receives the shutdown message, if it doesn't shut down during the `gracefulWorkerRestartTimeout`, the master forcibly kills it. [PR #1970][https://github.com/shakacode/react_on_rails/pull/1970] by [AbanoubGhadban](https://github.com/AbanoubGhadban).
43
58
 
44
59
  ### Changed
60
+
45
61
  - Upgraded HTTPX dependency from 1.3.4 to ~> 1.5 (currently 1.5.1). [PR 520](https://github.com/shakacode/react_on_rails_pro/pull/520) by [AbanoubGhadban](https://github.com/AbanoubGhadban).
46
62
 
47
63
  ## [4.0.0-rc.14] - 2025-06-22
48
64
 
49
65
  ### Improved
66
+
50
67
  - Improved RSC rendering flow by eliminating double rendering of server components and reducing the number of HTTP requests.
51
68
  - Updated communication protocol between Node Renderer and Rails to version 2.0.0 which supports the ability to upload multiple bundles at once.
52
69
  - Added the ability to communicate between different bundles on the renderer by using the `runOnOtherBundle` function which is globally available for the rendering request.
53
70
 
54
71
  [PR 515](https://github.com/shakacode/react_on_rails_pro/pull/515) by [AbanoubGhadban](https://github.com/AbanoubGhadban).
55
72
 
56
-
57
73
  ## [4.0.0-rc.13] - 2025-03-07
58
74
 
59
75
  ### Added
76
+
60
77
  - 🚀 **Introducing React Server Components Support!** 🎉
61
78
  - Experience the future of React with full RSC integration
62
79
  - Seamlessly use React Server Components in your Rails apps
@@ -67,24 +84,29 @@ You can find the **package** version numbers from this repo's tags and below in
67
84
  [PR 422](https://github.com/shakacode/react_on_rails_pro/pull/422) by [AbanoubGhadban](https://github.com/AbanoubGhadban).
68
85
 
69
86
  ### Changed (Breaking)
87
+
70
88
  - `ReactOnRailsPro::Utils#copy_assets` retuns `nil` instead of `Response` object. Because it throws an error if an error occurs.
71
89
 
72
90
  ## [4.0.0.rc.11] - 2025-02-09
73
91
 
74
92
  ### Changed
93
+
75
94
  - [PR 511](https://github.com/shakacode/react_on_rails_pro/pull/511) by [Romex91](https://github.com/Romex91)
95
+
76
96
  - Set `bodyLimit` to 100 MB by default to fix error 413.
77
97
  - Add `fastifyServerOptions` to the config
78
98
 
79
- - Specify exact httpx version until the bug there is fixed [PR #496](https://github.com/shakacode/react_on_rails_pro/pull/496) by [alexeyr-ci](https://github.com/alexeyr-ci)
99
+ - Specify exact httpx version until the bug there is fixed [PR #496](https://github.com/shakacode/react_on_rails_pro/pull/496) by [alexeyr-ci](https://github.com/alexeyr-ci)
80
100
 
81
101
  ### Changed
102
+
82
103
  - Renamed `includeTimerPolyfills` configuration option to `stubTimers`. [PR 506](https://github.com/shakacode/react_on_rails_pro/pull/506) by [alexeyr-ci](https://github.com/alexeyr-ci).
83
104
  - Fail immediately on detecting obsolete config options to prevent unexpected misconfigurations. [PR 506](https://github.com/shakacode/react_on_rails_pro/pull/506) by [alexeyr-ci](https://github.com/alexeyr-ci).
84
105
 
85
106
  ## [4.0.0.rc.9] - 2024-12-05
86
107
 
87
108
  ### Changed
109
+
88
110
  - Error reporting and tracing integrations are completely redone. See [the docs](./docs/node-renderer/error-reporting-and-tracing.md) for details. [PR 471](https://github.com/shakacode/react_on_rails_pro/pull/471) by [alexeyr-ci](https://github.com/alexeyr-ci).
89
111
  - Upgraded to Fastify 5 by default, with an option to fall back to Fastify 4 on older Node versions. [PR 478](https://github.com/shakacode/react_on_rails_pro/pull/478) by [alexeyr-ci](https://github.com/alexeyr-ci).
90
112
  - Logging now uses Pino instead of Winston, aligning with Fastify. [PR 479](https://github.com/shakacode/react_on_rails_pro/pull/479) by [alexeyr-ci](https://github.com/alexeyr-ci).
@@ -95,6 +117,7 @@ You can find the **package** version numbers from this repo's tags and below in
95
117
  ## [4.0.0.rc.6] - 2024-11-12
96
118
 
97
119
  ### Added
120
+
98
121
  - Added streaming server rendering support:
99
122
  - [PR 407](https://github.com/shakacode/react_on_rails_pro/pull/407) by [AbanoubGhadban](https://github.com/AbanoubGhadban).
100
123
  - New `stream_view_containing_react_components` helper method that can be used with `stream_react_component` helper method in react_on_rails gem.
@@ -109,24 +132,29 @@ You can find the **package** version numbers from this repo's tags and below in
109
132
  - [PR 440](https://github.com/shakacode/react_on_rails_pro/pull/440) by [AbanoubGhadban](https://github.com/AbanoubGhadban)
110
133
 
111
134
  ### Removed
135
+
112
136
  - Drop support for EOL'd Ruby 2.7 [PR 365](https://github.com/shakacode/react_on_rails_pro/pull/365) by [ahangarha](https://github.com/ahangarha).
113
137
  - Drop support for React on Rails below 14.0.4 [PR 415](https://github.com/shakacode/react_on_rails_pro/pull/415) by [rameziophobia](https://github.com/rameziophobia).
114
138
 
115
139
  ### Fixed
140
+
116
141
  - Updated multiple JS dependencies for bug fixes.
117
142
  - Added execute permission for `spec/dummy/bin/dev` [PR 387](https://github.com/shakacode/react_on_rails_pro/pull/387) by [alexeyr](https://github.com/alexeyr).
118
143
  - Made default bundle paths in node-renderer and Rails consistent [PR 399](https://github.com/shakacode/react_on_rails_pro/pull/399) by [alexeyr-ci](https://github.com/alexeyr-ci).
119
144
 
120
145
  ### Changed
146
+
121
147
  - Support Shakapacker 8.0.0, Modified webpack configurations to use shakapacker instead of webpacker. This drops support for shakapacker 6.X [PR 415](https://github.com/shakacode/react_on_rails_pro/pull/415) by [rameziophobia](https://github.com/rameziophobia).
122
148
  - Converted the node-renderer worker from Express to Fastify [PR 398](https://github.com/shakacode/react_on_rails_pro/pull/398) by [alexeyr-ci](https://github.com/alexeyr-ci).
123
149
 
124
150
  ## [3.3.1] - 2025-08-11
125
151
 
126
152
  ### Changed
153
+
127
154
  - Converted JS code to TS [PR 386](https://github.com/shakacode/react_on_rails_pro/pull/386) and [PR 389](https://github.com/shakacode/react_on_rails_pro/pull/389) by [alexeyr-ci](https://github.com/alexeyr-ci).
128
155
 
129
156
  ### Fixed
157
+
130
158
  - Removed file size limit for assets and bundles. [PR 459](https://github.com/shakacode/react_on_rails_pro/pull/459) by [alexeyr-ci](https://github.com/alexeyr-ci).
131
159
  - Enabled use as a `git:` dependency. [PR 490](https://github.com/shakacode/react_on_rails_pro/pull/490) by [alexeyr-ci](https://github.com/alexeyr-ci).
132
160
  - Enabled `queueMicrotask` use in server bundle to support React 19. [PR 505](https://github.com/shakacode/react_on_rails_pro/pull/505) by [alexeyr-ci](https://github.com/alexeyr-ci).
@@ -134,65 +162,84 @@ You can find the **package** version numbers from this repo's tags and below in
134
162
  - Made compatible with Ruby 3.4. [PR 541](https://github.com/shakacode/react_on_rails_pro/pull/541) by [alexeyr-ci2](https://github.com/alexeyr-ci2).
135
163
 
136
164
  ## [3.2.1] - 2023-06-07
165
+
137
166
  Fixed release, supports Ruby 2.7.5.
138
167
 
139
168
  See branch https://github.com/shakacode/react_on_rails_pro/tree/3-support-ruby-2-7
140
169
 
141
170
  ### Fixed
171
+
142
172
  - Removed console errors when `setTimeout` is used server-size. The call is silently ignored for seamless integration of https://github.com/petyosi/react-virtuoso
143
173
  - Numerous Dependabot alerts
144
174
 
145
175
  ## Doc and Spec Only Updates
176
+
146
177
  React 18 is now supported! Check the [React on Rails CHANGELOG.md](https://github.com/shakacode/react_on_rails/blob/master/CHANGELOG.md) for details and the updates to the [loadable-components instructions](https://github.com/shakacode/react_on_rails_pro/blob/master/docs/code-splitting-loadable-components.md).
147
178
 
148
179
  ### Improved
180
+
149
181
  - Updated `Rubocop` version from `1.18.3` to `1.36.0`. Fixed Rubocop warnings. [PR 296](https://github.com/shakacode/react_on_rails_pro/pull/296) by [alkesh26](https://github.com/alkesh26).
150
182
  - Updated dependencies to address known security vulnerabilities
151
183
 
152
184
  ## [3.1.0] - 2022-08-03
185
+
153
186
  ### Fixed
187
+
154
188
  - Removes `include_execjs_polyfills` options from RoRP gem configuration & adds `include_timer_polyfills` option for Node Renderer configuration, which enables use of setTimeout & other timer functions during server rendering. [PR 281](https://github.com/shakacode/react_on_rails_pro/pull/281) by [judahmeek](https://github.com/judahmeek).
155
189
 
156
190
  ### Improvement
191
+
157
192
  - Warn, do not raise on missing assets [PR 280](https://github.com/shakacode/react_on_rails_pro/pull/280) by [Romex91](https://github.com/Romex91)
158
193
 
159
194
  ## [3.0.1] - 2022-07-011
195
+
160
196
  ### Fixed
197
+
161
198
  - Fix possible `uninitialized constant ReactOnRails (NameError)` in `lib/react_on_rails_pro/error.rb:4`. [PR 277](https://github.com/shakacode/react_on_rails_pro/pull/273) by [alexeyr](https://github.com/alexeyr).
162
199
 
163
200
  ## [3.0.0] - 2022-07-07
201
+
164
202
  ### Fixed
203
+
165
204
  - Make asset paths in PrepareNodeRenderBundles relative too. The symlink to the bundle itself was made relative in #231, but asset symlinks remained absolute. This makes them relative too. Fixes #272. [PR 273](https://github.com/shakacode/react_on_rails_pro/pull/273) by [alexeyr](https://github.com/alexeyr).
166
205
 
167
206
  ## [3.0.0-rc.4] - 2022-06-28
207
+
168
208
  ### Fixed
209
+
169
210
  - Add RAILS_ENV to bundle cache key. This ensures a development bundle will never get accidentally deployed to production. [PR 270](https://github.com/shakacode/react_on_rails_pro/pull/270) by [justin808](https://github.com/justin808).
170
211
  - Replace use of utc_timestamp with Utils.bundle_hash. Important fix as timestamps are not stable between build time and the deployment of a Heroku slug. [PR 269](https://github.com/shakacode/react_on_rails_pro/pull/269) by [Judahmeek](https://github.com/Judahmeek).
171
212
 
172
213
  ## [3.0.0-rc.3] - 2022-04-14
173
214
 
174
215
  ### Fixed
216
+
175
217
  - Fix prepare_node_renderer script. [PR 254](https://github.com/shakacode/react_on_rails_pro/pull/254) by [judahmeek](https://github.com/judahmeek).
176
218
  - Better logging for error 'Request protocol undefined does not match installed renderer protocol'. [PR 252](https://github.com/shakacode/react_on_rails_pro/pull/252) by [justin808](https://github.com/justin808).
177
219
 
178
220
  ## [3.0.0-rc.1] - 2022-02-26
179
221
 
180
222
  ### Fixed
223
+
181
224
  - Use relative source path for bundle symlink which conflicted with extraction of (Heroku) slugs caching resulting in incorrect extraction of the slugs due to absolute paths in the symlinks. [PR 231](https://github.com/shakacode/react_on_rails_pro/pull/231) by [judahmeek](https://github.com/judahmeek).
182
225
 
183
226
  ## [3.0.0-rc.0] - 2021-10-27
184
227
 
185
228
  ### Upgrading to 3.0
229
+
186
230
  1. Changed rake task name from vm to node:
187
231
  Rename react_on_rails_pro:pre_stage_bundle_for_vm_renderer to react_on_rails_pro:pre_stage_bundle_for_node_renderer
188
232
  2. **Bundle Caching**: ReactOnRailsPro::AssetsPrecompile will automatically pre_stage_bundle_for_node_renderer if using the node_renderer. So don't do this twice in another place if using ReactOnRailsPro::AssetsPrecompile for bundle caching. You might have modified your own assets:precompile task.
189
233
 
190
234
  ### Changed
235
+
191
236
  - Moved default location of placed node renderer sym links to be /.node-renderer-bundles as the /tmp directory is typically
192
237
  cleared during slug trimming
193
238
 
194
239
  ### Added
240
+
195
241
  - [PR 220](https://github.com/shakacode/react_on_rails_pro/pull/220) by [justin808](https://github.com/justin808).
242
+
196
243
  - **Add `ssr_timeout` configuration** so the Rails server will not wait more than this many seconds for a SSR request to return once issued.
197
244
  - Change default for `renderer_use_fallback_exec_js` to `false`.
198
245
  - Change default log level to info.
@@ -200,6 +247,7 @@ React 18 is now supported! Check the [React on Rails CHANGELOG.md](https://githu
200
247
  - Add support for render functions to be async (returning promises). Also add `include_execjs_polyfills` option to configuration for React on Rails to optionally stop stubbing of setTimeout, setInterval, & clearTimeout polyfills while using NodeRenderer. [PR 210](https://github.com/shakacode/react_on_rails_pro/pull/210) by [judahmeek](https://github.com/judahmeek).
201
248
 
202
249
  ### Fixed
250
+
203
251
  - Ability to call `server_render_js(raw_js)` fixed. Previously, always errored.
204
252
  - Errors during rendering result in ReactOnRails::PrerenderError
205
253
  - When retrying rendering, the retry message is more clear
@@ -207,6 +255,7 @@ React 18 is now supported! Check the [React on Rails CHANGELOG.md](https://githu
207
255
  ## [2.3.0] - 2021-09-22
208
256
 
209
257
  ### Added
258
+
210
259
  - Configuration option for `ssr_timeout` so the Rails server will not wait more than this many seconds
211
260
  for a SSR request to return once issued. Default timeout if not set is 5.
212
261
  `config.ssr_timeout = 5`
@@ -221,110 +270,144 @@ React 18 is now supported! Check the [React on Rails CHANGELOG.md](https://githu
221
270
  [justin808](https://github.com/justin808) and [ershadul1](https://github.com/ershadul1).
222
271
 
223
272
  ## [2.2.0] - 2021-07-13
273
+
224
274
  - Change rake react_on_rails_pro:pre_stage_bundle_for_vm_renderer to use symlinks to save slug size. [PR 202](https://github.com/shakacode/react_on_rails_pro/pull/202) by [justin808](https://github.com/justin808).
225
275
 
226
276
  ## [2.1.1] - 2021-05-29
277
+
227
278
  - Add optional extra cache values for bundle caching. The cache adapter can now provide a method cache_keys. [PR 196](https://github.com/shakacode/react_on_rails_pro/pull/196) by [justin808](https://github.com/justin808).
228
279
 
229
280
  ## [2.1.0] - 2021-05-15
230
281
 
231
282
  ### Added
283
+
232
284
  - Optional production bundle caching. [PR 179](https://github.com/shakacode/react_on_rails_pro/pull/179) by [judahmeek](https://github.com/judahmeek).
233
285
  - Added configurations:
234
286
  - `excluded_dependency_globs`: don't include these in caches
235
287
  - `remote_bundle_cache_adapter`: See `docs/bundle-caching.md
236
288
 
237
- ------
289
+ ---
238
290
 
239
291
  ### 2.0 Upgrade Steps
292
+
240
293
  1. Update React on Rails to 12.2.0
241
294
  2. Be sure to use an API key that has the Github package access and know your API key username. For questions, message Justin Gordon on Slack or [justin@shakacode.com](mailto:justin@shakacode.com).
242
295
 
243
-
244
296
  In your `config/initializers/react_on_rails_pro.rb`:
297
+
245
298
  1. Rename any references from `config.serializer_globs` to `config.dependency_globs`
246
299
  1. Rename any references from `vm-renderer` to `node-renderer`
247
300
  1. Rename `vmRenderer` to `NodeRenderer`
248
301
 
249
302
  Follow the steps for the new installation that uses Github Packages: [docs/installation.md](https://github.com/shakacode/react_on_rails_pro/blob/master/docs/installation.md).
303
+
250
304
  1. Be sure to namespace the package like `require('@shakacode-tools/react-on-rails-pro-node-renderer');`
251
305
  1. Add the Honeybadger ("@honeybadger-io/js") or Sentry ("@sentry/node") NPM packages, as those used to be **dependencies**. Now they are optional.
252
306
  1. Add the `@sentry/tracing` package if you want to try Sentry tracing. See [Error Reporting and Tracing for Sentry and HoneyBadger](./docs/node-renderer/error-reporting-and-tracing.md).
253
307
 
254
308
  For example, the old code might be:
309
+
255
310
  ```js
256
311
  const { reactOnRailsProVmRenderer } = require('react-on-rails-pro-vm-renderer');
257
312
  ```
313
+
258
314
  New
315
+
259
316
  ```js
260
317
  const { reactOnRailsProNodeRenderer } = require('@shakacode-tools/react-on-rails-pro-node-renderer');
261
318
  ```
262
- ------
319
+
320
+ ---
321
+
263
322
  ## [2.0.0] - 2021-04-02
323
+
264
324
  - See 2.0 Upgrade steps!
265
325
 
266
326
  ## [2.0.0.beta.3] - 2021-03-31
327
+
267
328
  #### Improved
329
+
268
330
  - Warn, do not raise on missing assets [PR 176](https://github.com/shakacode/react_on_rails_pro/pull/176) by [Romex91](https://github.com/Romex91)
269
331
 
270
332
  ## [2.0.0.beta.2] - 2021-03-23
333
+
271
334
  #### Added
335
+
272
336
  - Added option `config.throw_js_errors` so that any errors in SSR will go to the console plus HoneyBadger/Sentry. [PR 174](https://github.com/shakacode/react_on_rails_pro/pull/174) by [justin808](https://github.com/justin808).
273
337
 
274
338
  #### Fixed
339
+
275
340
  - Logs missing error reporting packages (Sentry/HoneyBadger) instead of throwing an error. [PR 174](https://github.com/shakacode/react_on_rails_pro/pull/174) by [justin808](https://github.com/justin808).
276
341
 
277
342
  ## [2.0.0.beta.1] - 2021-03-14
278
- * Added Sentry Tracing support. [PR 150](https://github.com/shakacode/react_on_rails_pro/pull/150) by [ashgaliyev](https://github.com/ashgaliyev). To use this feature, you need to add `config.sentryTracing = true` (or ENV `SENTRY_TRACING=true`) and optionally the `config.sentryTracesSampleRate = 0.5` (or ENV `SENTRY_TRACES_SAMPLE_RATE=0.5`). The value of the sample rate is the percentage of requests to trace. For documentation of Sentry Tracing, see the [Sentry Performance Monitoring Docs](https://docs.sentry.io/platforms/ruby/performance/), the [Sentry Distributed Tracing Docs](https://docs.sentry.io/product/performance/distributed-tracing/), and the [Sentry Sampling Transactions Docs](https://docs.sentry.io/platforms/ruby/performance/sampling/). The default **config.sentryTracesSampleRate** is **0.1**.
279
343
 
280
- - Renamed `config.serializer_globs`to `config.dependency_globs`. [PR 165](https://github.com/shakacode/react_on_rails_pro/pull/165) by [judahmeek](https://github.com/judahmeek)
281
- - RORP_CACHE_HIT and RORP_CACHE_KEY is returned for prerender caching, which is only when there is no fragment caching.
282
- - Improve cache information from react_component_hash. Hash result now includes 2 new keys
283
- * RORP_CACHE_HIT
284
- * RORP_CACHE_KEY
285
- Additionally, ReactOnRailsPro::Utils.printable_cache_key(cache_key) added.
286
- - [PR 170](https://github.com/shakacode/react_on_rails_pro/pull/170) by [justin808](https://github.com/justin808).
344
+ - Added Sentry Tracing support. [PR 150](https://github.com/shakacode/react_on_rails_pro/pull/150) by [ashgaliyev](https://github.com/ashgaliyev). To use this feature, you need to add `config.sentryTracing = true` (or ENV `SENTRY_TRACING=true`) and optionally the `config.sentryTracesSampleRate = 0.5` (or ENV `SENTRY_TRACES_SAMPLE_RATE=0.5`). The value of the sample rate is the percentage of requests to trace. For documentation of Sentry Tracing, see the [Sentry Performance Monitoring Docs](https://docs.sentry.io/platforms/ruby/performance/), the [Sentry Distributed Tracing Docs](https://docs.sentry.io/product/performance/distributed-tracing/), and the [Sentry Sampling Transactions Docs](https://docs.sentry.io/platforms/ruby/performance/sampling/). The default **config.sentryTracesSampleRate** is **0.1**.
345
+
346
+ * Renamed `config.serializer_globs`to `config.dependency_globs`. [PR 165](https://github.com/shakacode/react_on_rails_pro/pull/165) by [judahmeek](https://github.com/judahmeek)
347
+ * RORP_CACHE_HIT and RORP_CACHE_KEY is returned for prerender caching, which is only when there is no fragment caching.
348
+ * Improve cache information from react_component_hash. Hash result now includes 2 new keys
349
+ - RORP_CACHE_HIT
350
+ - RORP_CACHE_KEY
351
+ Additionally, ReactOnRailsPro::Utils.printable_cache_key(cache_key) added.
352
+ * [PR 170](https://github.com/shakacode/react_on_rails_pro/pull/170) by [justin808](https://github.com/justin808).
287
353
 
288
354
  ## [2.0.0.beta.0] - 2020-12-03
289
- * Renamed VM Renderer to Node Renderer. [PR 140](https://github.com/shakacode/react_on_rails_pro/pull/140) by [justin808](https://github.com/justin808).
355
+
356
+ - Renamed VM Renderer to Node Renderer. [PR 140](https://github.com/shakacode/react_on_rails_pro/pull/140) by [justin808](https://github.com/justin808).
290
357
 
291
358
  ### Fixed
359
+
292
360
  - Cache key not stable between machines same deploy. [PR 159](https://github.com/shakacode/react_on_rails_pro/pull/136) by [justin808](https://github.com/justin808).
293
361
 
294
362
  ## [1.5.6] - 2020-12-02
363
+
295
364
  Switched to releases being published packages.
296
365
 
297
366
  ### Fixed
367
+
298
368
  - Minor fix to error messages
299
369
  - Updated gem and package dependencies
300
370
 
301
371
  ## [1.5.5] - 2020-08-17
372
+
302
373
  ### Added
374
+
303
375
  - Added request retrying in case of timeouts. [PR 136](https://github.com/shakacode/react_on_rails_pro/pull/136) by [ashgaliyev](https://github.com/ashgaliyev).
304
376
 
305
377
  ## [1.5.4] - 2020-07-22
378
+
306
379
  ### Added
380
+
307
381
  - Added support for Github packages. To switch from using the Github private repo with a tag, request a new auth token from justin@shakacode.com.
308
382
 
309
383
  ## [1.5.3] - 2020-06-30
384
+
310
385
  ### Added
386
+
311
387
  - Added sentry support. [PR 132](https://github.com/shakacode/react_on_rails_pro/pull/132) by [ashgaliyev](https://github.com/ashgaliyev).
312
388
 
313
389
  ## [1.5.2] - 2020-06-25
390
+
314
391
  ### Improved
392
+
315
393
  - Added `process` and `Buffer` to the context if `suppportModules === true`. [PR 131](https://github.com/shakacode/react_on_rails_pro/pull/131) by [ashgaliyev](https://github.com/ashgaliyev).
316
394
 
317
395
  ## [1.5.1] - 2020-03-25
396
+
318
397
  ### Improved
319
- - config.assets_to_copy can take a single value in addition to an array. [PR 122](https://github.com/shakacode/react_on_rails_pro/pull/122 ) [justin808](https://github.com/justin808).
320
- - Better handling for an invalid renderer_url configuration. [PR 109](https://github.com/shakacode/react_on_rails_pro/pull/109 ) [justin808](https://github.com/justin808).
398
+
399
+ - config.assets_to_copy can take a single value in addition to an array. [PR 122](https://github.com/shakacode/react_on_rails_pro/pull/122) [justin808](https://github.com/justin808).
400
+ - Better handling for an invalid renderer_url configuration. [PR 109](https://github.com/shakacode/react_on_rails_pro/pull/109) [justin808](https://github.com/justin808).
321
401
 
322
402
  ## [1.5.0] - 2020-03-17
403
+
323
404
  ### Added
405
+
324
406
  - Added support for loadable components SSR [PR 112](https://github.com/shakacode/react_on_rails_pro/pull/112) and [PR 118](https://github.com/shakacode/react_on_rails_pro/pull/118) by [ashgaliyev](https://github.com/ashgaliyev) and [justin808](https://github.com/justin808).
325
407
  - New option added to the node-renderer: `supportModules`. This setting is necessary for using [loadable-components](https://github.com/gregberge/loadable-components/). See [Server-side rendering with code-splitting using Loadable/Components](https://github.com/shakacode/react_on_rails_pro/blob/master/docs/code-splitting-loadable-components.md) for more detailss.
326
408
 
327
409
  ### Changed
410
+
328
411
  - Updated to bundler V2. [PR 114](https://github.com/shakacode/react_on_rails_pro/pull/114) by [justin808](https://github.com/justin808).
329
412
  - Updated spec dummy. [PR 115](https://github.com/shakacode/react_on_rails_pro/pull/115) by [justin808](https://github.com/justin808).
330
413
 
@@ -333,28 +416,39 @@ Switched to releases being published packages.
333
416
  ## [1.4.4] - 2019-06-10
334
417
 
335
418
  ### Fixed
419
+
336
420
  - Improve error handling. [PR 103](https://github.com/shakacode/react_on_rails_pro/pull/103) by [justin808](https://github.com/justin808).
337
421
 
338
422
  ## [1.4.3] - 2019-06-06
423
+
339
424
  ### Fixed
425
+
340
426
  - Lock timeouts and update error handling. Previously, many renderer errors resulted in crashes rather than a fallback
341
- to ExecJS. Also, lengthened the lock timeouts for the bundle lock. [PR 100](https://github.com/shakacode/react_on_rails_pro/pull/100) by [justin808](https://github.com/justin808).
427
+ to ExecJS. Also, lengthened the lock timeouts for the bundle lock. [PR 100](https://github.com/shakacode/react_on_rails_pro/pull/100) by [justin808](https://github.com/justin808).
342
428
  - Added check to skip pre-render cache for components rendered by `cache_react_component` and `cache_react_component_hash` because this saves on cache storage, thus improving overall performance. [PR 91](https://github.com/shakacode/react_on_rails_pro/pull/91) by [ashgaliyev](https://github.com/ashgaliyev).
343
429
 
344
430
  ## [1.4.2] - 2019-05-26
431
+
345
432
  ### Changed
433
+
346
434
  - Removed babel processing. Node v12 recommended. [PR 93](https://github.com/shakacode/react_on_rails_pro/pull/91) by [ashgaliyev](https://github.com/ashgaliyev).
347
435
 
348
436
  ## [1.4.1] - 2019-03-19
437
+
349
438
  ### Fixed
439
+
350
440
  - `cached_react_component_hash` incorrectly failed to include the bundle_hash unless `prerender: true` was used as an option. This fix addresses that issue. There is no need to use `prerender: true` as generating a hash only makes sense if prerendering is done. [PR 82](https://github.com/shakacode/react_on_rails_pro/pull/82) by [justin808](https://github.com/justin808).
351
441
 
352
442
  ## [1.4.0] - 2019-01-15
443
+
353
444
  ### Added
445
+
354
446
  - Added config option `honeybadgerApiKey` or ENV value `HONEYBADGER_API_KEY` so that errors can flow to HoneyBadger. [PR 93](https://github.com/shakacode/react_on_rails_pro/pull/75) by [ashgaliyev](https://github.com/ashgaliyev).
355
447
 
356
448
  ## [1.3.1] - 2018-12-26
449
+
357
450
  ### Added
451
+
358
452
  - Added option `cache_options:` to the cached_react_component_hash and cached_react_component
359
453
  a hash including values such as :compress, :expires_in, :race_condition_ttl
360
454
  - Added option `:if`, `:unless` to the cached_react_component_hash and cached_react_component
@@ -365,49 +459,61 @@ to ExecJS. Also, lengthened the lock timeouts for the bundle lock. [PR 100](http
365
459
  Above are in [PR 82](https://github.com/shakacode/react_on_rails_pro/pull/82) by [justin808](https://github.com/justin808)
366
460
 
367
461
  ## [1.3.0] - 2018-12-18
368
- * **Migration:** react_on_rails must be updated to version >= 11.2.1.
462
+
463
+ - **Migration:** react_on_rails must be updated to version >= 11.2.1.
369
464
 
370
465
  ### Added
466
+
371
467
  - Added `config.ssr_pre_hook_js` to call some JavaScript to clear out state from libraries that
372
468
  misbehave during server Rendering. For example, suppose that we had to call `SomeLibrary.clearCache()`
373
469
  between calls to server renderer. Note, SomeLibrary needs to be globally exposed in the server
374
470
  rendering webpack bundle.
375
471
 
376
472
  ## [1.2.1] - 2018-08-26
473
+
377
474
  ### Fixed
378
- * Major overhaul of the node-renderer. Improved logging and error handling, ready for async
379
- * Fixed race conditions with init of renderer
380
- * Improved logging
381
- * Ensuring all places that an error will result in a 400 sent to the rails server.
382
- * Handle threading issue with writing the bundle by using a lockfile.
383
- * Change internals so that async rendering is ready.
384
- * Add debugging instructions
385
- * Promisified some node APIs and wrote everything with careful async/await syntax, ensuring that errors are always caught and that promises are always returned from the async functions.
475
+
476
+ - Major overhaul of the node-renderer. Improved logging and error handling, ready for async
477
+ - Fixed race conditions with init of renderer
478
+ - Improved logging
479
+ - Ensuring all places that an error will result in a 400 sent to the rails server.
480
+ - Handle threading issue with writing the bundle by using a lockfile.
481
+ - Change internals so that async rendering is ready.
482
+ - Add debugging instructions
483
+ - Promisified some node APIs and wrote everything with careful async/await syntax, ensuring that errors are always caught and that promises are always returned from the async functions.
386
484
 
387
485
  Above are in [PR 65](https://github.com/shakacode/react_on_rails_pro/pull/65) by [justin808](https://github.com/justin808).
388
486
 
389
487
  ## [1.2.0]
390
- * **Migration:** react_on_rails must be updated to version 11.1.x+.
488
+
489
+ - **Migration:** react_on_rails must be updated to version 11.1.x+.
391
490
 
392
491
  ### Added
492
+
393
493
  - Added `serializer_globs` configuration value to add a MD5 of serializer files to the cache key for fragment caching. [#60](https://github.com/shakacode/react_on_rails_pro/pull/60) by [justin808](https://github.com/justin808).
394
494
  - More efficient calculation of the request digest. Previously, we would do a regexp replace to filter out the dom node id because if was randomized. React on Rails 11.1.x provides a default to say not to randomize. [#64](https://github.com/shakacode/react_on_rails_pro/pull/64) by [justin808](https://github.com/justin808).
395
495
 
396
496
  ### Fixed
497
+
397
498
  - Fix for truncation of code and better error logs. This fixes the issue with truncation of the code when over 1 MB due to large props. Max changes to 10 MB. [#63](https://github.com/shakacode/react_on_rails_pro/pull/63) by [justin808](https://github.com/justin808).
398
499
 
399
500
  ## [1.1.0]
501
+
400
502
  ### Added
503
+
401
504
  - Added `tracing` configuration flag to time server rendering calls
402
505
 
403
506
  ### Changed
507
+
404
508
  - Default usage of PORT and LOG_LEVEL for the node-renderer bin file changed to use values RENDERER_PORT and RENDERER_LOG_LEVEL
405
509
  - Default Rails config.server_render is "ExecJS". Previously was "VmRenderer"
406
510
 
407
511
  Above changes in [PR 52](https://github.com/shakacode/react_on_rails_pro/pull/52) by [justin808](https://github.com/justin808).
408
512
 
409
513
  ## [1.0.0]
514
+
410
515
  ### Added
516
+
411
517
  - support for node renderer & fallback renderer
412
518
  - support for javascript evaluation caching
413
519
  - advanced error handling
@@ -50,6 +50,7 @@ group :development, :test do
50
50
  gem 'pry-rails' # Causes rails console to open pry. `DISABLE_PRY_RAILS=1 rails c` can still open with IRB
51
51
  gem 'pry-theme' # An easy way to customize Pry colors via theme files
52
52
 
53
+ gem "rbs", require: false
53
54
  gem "rubocop", "1.36.0", require: false
54
55
  gem 'rubocop-performance', "1.15.0", require: false
55
56
  gem 'rubocop-rspec', "2.13.2", require: false