react_on_rails_pro 16.4.0.rc.5 → 16.4.0.rc.6
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -3
- data/README.md +4 -3
- data/app/helpers/react_on_rails_pro_helper.rb +26 -1
- data/docs/code-splitting-loadable-components.md +8 -11
- data/docs/ruby-api.md +2 -4
- data/docs/updating.md +1 -1
- data/lib/react_on_rails_pro/concerns/stream.rb +16 -8
- data/lib/react_on_rails_pro/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d41e1dcb19326994f54698beebb6194a198eb967beea7346b08a376fb86068fd
|
|
4
|
+
data.tar.gz: 98ca3512787b5d444266eb0cac44420b6a991aab2d928305c8640c752b3981d3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a802fe1da5ebcd4571d4c75d5df49dec8d4894ac298c73e376f31ee34a12faaa0db4b78d137c96932354e366dfbc7ac168c79bcf911721f709e4f5ba52078592
|
|
7
|
+
data.tar.gz: 31d4f3e670a195d169aa256876a02802341235c439dc9f815f8216c4db8bfbdca933d31acf8e69e845c2e88fa4e897cc49139e89a03a02379eca55acc91735dd
|
data/Gemfile.lock
CHANGED
|
@@ -9,7 +9,7 @@ GIT
|
|
|
9
9
|
PATH
|
|
10
10
|
remote: ..
|
|
11
11
|
specs:
|
|
12
|
-
react_on_rails (16.4.0.rc.
|
|
12
|
+
react_on_rails (16.4.0.rc.6)
|
|
13
13
|
addressable
|
|
14
14
|
connection_pool
|
|
15
15
|
execjs (~> 2.5)
|
|
@@ -20,7 +20,7 @@ PATH
|
|
|
20
20
|
PATH
|
|
21
21
|
remote: .
|
|
22
22
|
specs:
|
|
23
|
-
react_on_rails_pro (16.4.0.rc.
|
|
23
|
+
react_on_rails_pro (16.4.0.rc.6)
|
|
24
24
|
addressable
|
|
25
25
|
async (>= 2.6)
|
|
26
26
|
connection_pool
|
|
@@ -29,7 +29,7 @@ PATH
|
|
|
29
29
|
httpx (~> 1.5)
|
|
30
30
|
jwt (~> 2.7)
|
|
31
31
|
rainbow
|
|
32
|
-
react_on_rails (= 16.4.0.rc.
|
|
32
|
+
react_on_rails (= 16.4.0.rc.6)
|
|
33
33
|
|
|
34
34
|
GEM
|
|
35
35
|
remote: https://rubygems.org/
|
data/README.md
CHANGED
|
@@ -191,11 +191,12 @@ High-performance standalone Node.js server for server-side rendering with connec
|
|
|
191
191
|
**Example Configuration:**
|
|
192
192
|
|
|
193
193
|
```javascript
|
|
194
|
-
//
|
|
195
|
-
const
|
|
194
|
+
// node-renderer.js
|
|
195
|
+
const path = require('path');
|
|
196
|
+
const { reactOnRailsProNodeRenderer } = require('react-on-rails-pro-node-renderer');
|
|
196
197
|
|
|
197
198
|
reactOnRailsProNodeRenderer({
|
|
198
|
-
|
|
199
|
+
serverBundleCachePath: path.resolve(__dirname, '.node-renderer-bundles'),
|
|
199
200
|
port: 3800,
|
|
200
201
|
workersCount: 4,
|
|
201
202
|
supportModules: true, // Required for loadable-components
|
|
@@ -438,11 +438,36 @@ module ReactOnRailsProHelper
|
|
|
438
438
|
stream = yield
|
|
439
439
|
process_stream_chunks(stream, first_chunk_var, all_chunks)
|
|
440
440
|
on_complete&.call(all_chunks)
|
|
441
|
+
rescue StandardError => e
|
|
442
|
+
# Propagate the error to the calling fiber via the variable.
|
|
443
|
+
# Async::Variable can only be resolved once — if it was already resolved
|
|
444
|
+
# (first chunk was returned successfully), the assignment raises and we
|
|
445
|
+
# fall through to re-raise so barrier.wait propagates the error later.
|
|
446
|
+
begin
|
|
447
|
+
first_chunk_var.value = e
|
|
448
|
+
# Variable accepted the error — this is a pre-first-chunk failure (e.g., shell error).
|
|
449
|
+
# The caller will detect the Exception value and raise it synchronously,
|
|
450
|
+
# BEFORE the response is committed, enabling a proper HTTP redirect.
|
|
451
|
+
# Do NOT re-raise here: the caller owns the error now.
|
|
452
|
+
rescue StandardError
|
|
453
|
+
# Variable was already resolved — the first chunk was returned successfully.
|
|
454
|
+
# This is a post-first-chunk error. Re-raise so barrier.wait propagates it
|
|
455
|
+
# (the response is already committed at that point, so only JS redirect is possible).
|
|
456
|
+
raise e
|
|
457
|
+
end
|
|
441
458
|
end
|
|
442
459
|
|
|
443
460
|
# Wait for and return the first chunk (blocking)
|
|
444
461
|
first_chunk_var.wait
|
|
445
|
-
first_chunk_var.value
|
|
462
|
+
result = first_chunk_var.value
|
|
463
|
+
|
|
464
|
+
# If the async task stored an exception (pre-first-chunk error), raise it now.
|
|
465
|
+
# This happens BEFORE response.stream.write(template_string) in
|
|
466
|
+
# stream_view_containing_react_components, so the response is NOT yet committed
|
|
467
|
+
# and rescue_from can perform a proper HTTP redirect.
|
|
468
|
+
raise result if result.is_a?(StandardError)
|
|
469
|
+
|
|
470
|
+
result
|
|
446
471
|
end
|
|
447
472
|
|
|
448
473
|
def process_stream_chunks(stream, first_chunk_var, all_chunks)
|
|
@@ -284,9 +284,8 @@ reactOnRailsProNodeRenderer(config);
|
|
|
284
284
|
## Making HMR Work
|
|
285
285
|
|
|
286
286
|
To make HMR work, it's best to disable loadable-components when using the Dev Server.
|
|
287
|
-
Note: you will need access to our **private** React on Rails Pro repository to open the following links.
|
|
288
287
|
|
|
289
|
-
Take a look at the code searches for ['imports-loadable'](https://github.com/shakacode/
|
|
288
|
+
Take a look at the code searches for ['imports-loadable'](https://github.com/shakacode/react_on_rails/search?q=imports-loadable&type=code) and ['imports-hmr'](https://github.com/shakacode/react_on_rails/search?q=imports-hmr&type=code)
|
|
290
289
|
|
|
291
290
|
The general concept is that we have a non-loadable, HMR-ready, file that substitutes for the loadable-enabled one, with the suffixes `imports-hmr.js` instead of `imports-loadable.js`
|
|
292
291
|
|
|
@@ -294,7 +293,7 @@ The general concept is that we have a non-loadable, HMR-ready, file that substit
|
|
|
294
293
|
|
|
295
294
|
Use the [NormalModuleReplacement plugin](https://webpack.js.org/plugins/normal-module-replacement-plugin/):
|
|
296
295
|
|
|
297
|
-
[code](https://github.com/shakacode/
|
|
296
|
+
[code](https://github.com/shakacode/react_on_rails/blob/master/react_on_rails_pro/spec/dummy/config/webpack/commonWebpackConfig.js#L41-L49)
|
|
298
297
|
|
|
299
298
|
```js
|
|
300
299
|
if (isWebpackDevServer) {
|
|
@@ -313,17 +312,15 @@ And compare:
|
|
|
313
312
|
|
|
314
313
|
### Routes file
|
|
315
314
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
- [spec/dummy/client/app/components/Loadable/routes/Routes.imports-hmr.jsx](https://github.com/shakacode/react_on_rails_pro/blob/master/spec/dummy/client/app/components/Loadable/routes/Routes.imports-hmr.jsx)
|
|
319
|
-
- [spec/dummy/client/app/components/Loadable/routes/Routes.imports-loadable.jsx](https://github.com/shakacode/react_on_rails_pro/blob/master/spec/dummy/client/app/components/Loadable/routes/Routes.imports-loadable.jsx)
|
|
315
|
+
- [spec/dummy/client/app/components/Loadable/routes/Routes.imports-hmr.jsx](https://github.com/shakacode/react_on_rails/blob/master/react_on_rails_pro/spec/dummy/client/app/components/Loadable/routes/Routes.imports-hmr.jsx)
|
|
316
|
+
- [spec/dummy/client/app/components/Loadable/routes/Routes.imports-loadable.jsx](https://github.com/shakacode/react_on_rails/blob/master/react_on_rails_pro/spec/dummy/client/app/components/Loadable/routes/Routes.imports-loadable.jsx)
|
|
320
317
|
|
|
321
318
|
### Client-Side Startup
|
|
322
319
|
|
|
323
|
-
- [spec/dummy/client/app/loadable/loadable-client.imports-hmr.
|
|
324
|
-
- [spec/dummy/client/app/loadable/loadable-client.imports-loadable.jsx](https://github.com/shakacode/
|
|
320
|
+
- [spec/dummy/client/app/loadable/loadable-client.imports-hmr.jsx](https://github.com/shakacode/react_on_rails/blob/master/react_on_rails_pro/spec/dummy/client/app/loadable/loadable-client.imports-hmr.jsx)
|
|
321
|
+
- [spec/dummy/client/app/loadable/loadable-client.imports-loadable.jsx](https://github.com/shakacode/react_on_rails/blob/master/react_on_rails_pro/spec/dummy/client/app/loadable/loadable-client.imports-loadable.jsx)
|
|
325
322
|
|
|
326
323
|
### Server-Side Startup
|
|
327
324
|
|
|
328
|
-
- [spec/dummy/client/app/loadable/loadable-server.imports-hmr.jsx](https://github.com/shakacode/
|
|
329
|
-
- [spec/dummy/client/app/loadable/loadable-server.imports-loadable.jsx](https://github.com/shakacode/
|
|
325
|
+
- [spec/dummy/client/app/loadable/loadable-server.imports-hmr.jsx](https://github.com/shakacode/react_on_rails/blob/master/react_on_rails_pro/spec/dummy/client/app/loadable/loadable-server.imports-hmr.jsx)
|
|
326
|
+
- [spec/dummy/client/app/loadable/loadable-server.imports-loadable.jsx](https://github.com/shakacode/react_on_rails/blob/master/react_on_rails_pro/spec/dummy/client/app/loadable/loadable-server.imports-loadable.jsx)
|
data/docs/ruby-api.md
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
# Ruby API
|
|
2
2
|
|
|
3
|
-
Note: you will need access to our **private** React on Rails Pro repository to open the following links.
|
|
4
|
-
|
|
5
3
|
## View Helpers
|
|
6
4
|
|
|
7
|
-
See the [app/helpers/react_on_rails_pro_helper.rb](https://github.com/shakacode/
|
|
5
|
+
See the [app/helpers/react_on_rails_pro_helper.rb](https://github.com/shakacode/react_on_rails/blob/master/react_on_rails_pro/app/helpers/react_on_rails_pro_helper.rb) source.
|
|
8
6
|
|
|
9
7
|
## Utility Methods
|
|
10
8
|
|
|
11
|
-
See the [lib/react_on_rails_pro/utils.rb](https://github.com/shakacode/
|
|
9
|
+
See the [lib/react_on_rails_pro/utils.rb](https://github.com/shakacode/react_on_rails/blob/master/react_on_rails_pro/lib/react_on_rails_pro/utils.rb) source.
|
data/docs/updating.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
This guide is for existing React on Rails Pro customers who are:
|
|
8
8
|
|
|
9
|
-
-
|
|
9
|
+
- Previously using GitHub Packages authentication (private distribution)
|
|
10
10
|
- On version 16.2.0-beta.x or earlier
|
|
11
11
|
- Upgrading to version 16.2.0 or higher
|
|
12
12
|
|
|
@@ -41,20 +41,28 @@ module ReactOnRailsPro
|
|
|
41
41
|
buffer_size = ReactOnRailsPro.configuration.concurrent_component_streaming_buffer_size
|
|
42
42
|
@main_output_queue = Async::LimitedQueue.new(buffer_size)
|
|
43
43
|
|
|
44
|
-
# Render template - components will start streaming immediately
|
|
44
|
+
# Render template - components will start streaming immediately.
|
|
45
|
+
# If a shell error occurs, consumer_stream_async raises PrerenderError here
|
|
46
|
+
# (BEFORE the response is committed), enabling a proper HTTP redirect.
|
|
45
47
|
template_string = render_to_string(template: template, **render_options)
|
|
46
48
|
# View may contain extra newlines, chunk already contains a newline
|
|
47
49
|
# Having multiple newlines between chunks causes hydration errors
|
|
48
50
|
# So we strip extra newlines from the template string and add a single newline
|
|
49
51
|
response.stream.write(template_string)
|
|
50
52
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
drain_streams_concurrently(parent_task)
|
|
54
|
+
# Do not close the response stream in an ensure block.
|
|
55
|
+
# If an error occurs we may need the stream open to send diagnostic/error details
|
|
56
|
+
# (for example, ApplicationController#rescue_from in the dummy app).
|
|
57
|
+
response.stream.close if close_stream_at_end
|
|
58
|
+
rescue StandardError
|
|
59
|
+
# Stop all streaming tasks to prevent leaked async work.
|
|
60
|
+
# For pre-commit errors (e.g., shell error raised during render_to_string),
|
|
61
|
+
# the barrier may still have pending tasks that must be cancelled.
|
|
62
|
+
# For post-commit errors (from drain_streams_concurrently), the barrier
|
|
63
|
+
# is already stopped inside that method — stopping again is a no-op.
|
|
64
|
+
@async_barrier&.stop
|
|
65
|
+
raise
|
|
58
66
|
end
|
|
59
67
|
end
|
|
60
68
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: react_on_rails_pro
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 16.4.0.rc.
|
|
4
|
+
version: 16.4.0.rc.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Justin Gordon
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-03-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: addressable
|
|
@@ -128,14 +128,14 @@ dependencies:
|
|
|
128
128
|
requirements:
|
|
129
129
|
- - '='
|
|
130
130
|
- !ruby/object:Gem::Version
|
|
131
|
-
version: 16.4.0.rc.
|
|
131
|
+
version: 16.4.0.rc.6
|
|
132
132
|
type: :runtime
|
|
133
133
|
prerelease: false
|
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
|
135
135
|
requirements:
|
|
136
136
|
- - '='
|
|
137
137
|
- !ruby/object:Gem::Version
|
|
138
|
-
version: 16.4.0.rc.
|
|
138
|
+
version: 16.4.0.rc.6
|
|
139
139
|
- !ruby/object:Gem::Dependency
|
|
140
140
|
name: bundler
|
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|