react_on_rails 12.0.3.beta.0 → 12.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -1
- data/docs/basics/upgrading-react-on-rails.md +24 -4
- data/lib/react_on_rails/version.rb +1 -1
- data/package.json +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: 7ca3650879f76d12748c0bb421da2d776fec62e7599e23552de09b21d19e8bff
|
4
|
+
data.tar.gz: b1e30785a72bc83dd0671ddcb26f768bacfc2cb2ccc9293e93be36286848d281
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ee2dcd8f08ac5cb3a7980639673b06a38a6bd29aa9b0e3e7956a8e45a262b3ffd036fbea5d387be8f025a96cb2f8af2592bbb08b4a34edb6114df4554a7d74d
|
7
|
+
data.tar.gz: 1a21c1642097dc08f081b75e1dd9542128227a3464c76b4188e1e7e1471466a0273ef72151ca662272b08be7bec254085e7d6eb8287059baa60c6303b138f1cb
|
data/CHANGELOG.md
CHANGED
@@ -17,7 +17,7 @@ Changes since last non-beta release.
|
|
17
17
|
|
18
18
|
*Please add entries here for your pull requests that are not yet released.*
|
19
19
|
|
20
|
-
### [12.0.3] - 2020-09-
|
20
|
+
### [12.0.3] - 2020-09-20
|
21
21
|
#### Fixed
|
22
22
|
- Async script loading optimizes page load speed. With this fix, a bundle
|
23
23
|
can be loaded "async" and a handler function can determine when to hydrate.
|
@@ -34,8 +34,28 @@ Registered Objects are of the following type:
|
|
34
34
|
1. **Function that takes only zero or one params and you return a React Element**, often JSX. If the function takes zero or one params, there is **no migration needed** for that function.
|
35
35
|
```js
|
36
36
|
export default (props) => <Component {...props} />;
|
37
|
-
```
|
38
|
-
|
37
|
+
```
|
38
|
+
|
39
|
+
2. **Function that takes only zero or one params and you return an Object (_not a React Element_)**. If the function takes zero or one params, **you need to add one or two unused params so you have exactly 2 params** and then that function will be treated as a render function and it can return an Object rather than a React element. If you don't do this, you'll see this obscure error message:
|
40
|
+
|
41
|
+
```
|
42
|
+
[SERVER] message: Objects are not valid as a React child (found: object with keys {renderedHtml}). If you meant to render a collection of children, use an array instead.
|
43
|
+
in YourComponentRenderFunction
|
44
|
+
```
|
45
|
+
|
46
|
+
So look in YourComponentRenderFunction and do this change
|
47
|
+
|
48
|
+
```js
|
49
|
+
export default (props) => { renderedHTML: getRenderedHTML };
|
50
|
+
```
|
51
|
+
|
52
|
+
To have exactly 2 arguments:
|
53
|
+
|
54
|
+
```js
|
55
|
+
export default (props, _railsContext) => { renderedHTML: getRenderedHTML };
|
56
|
+
```
|
57
|
+
|
58
|
+
3. Function that takes **2 params** and returns **a React function or class component**. _Migration is needed as the older syntax returned a React Element._
|
39
59
|
A function component is a function that takes zero or one params and returns a React Element, like JSX. The correct syntax
|
40
60
|
looks like:
|
41
61
|
```js
|
@@ -43,8 +63,8 @@ Registered Objects are of the following type:
|
|
43
63
|
```
|
44
64
|
Note, you cannot return a React Element (JSX). See below for the migration steps. If your function that took **two params returned
|
45
65
|
an Object**, then no migration is required.
|
46
|
-
|
47
|
-
|
66
|
+
4. Function that takes **3 params** and uses the 3rd param, `domNodeId`, to call `ReactDOM.hydrate`. If the function takes 3 params, there is **no migration needed** for that function.
|
67
|
+
5. ES6 or ES5 class. There is **no migration needed**.
|
48
68
|
|
49
69
|
Previously, with case number 2, you could return a React Element.
|
50
70
|
|
data/package.json
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: react_on_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 12.0.3
|
4
|
+
version: 12.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Gordon
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-09-
|
11
|
+
date: 2020-09-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -508,9 +508,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
508
508
|
version: 2.5.0
|
509
509
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
510
510
|
requirements:
|
511
|
-
- - "
|
511
|
+
- - ">="
|
512
512
|
- !ruby/object:Gem::Version
|
513
|
-
version:
|
513
|
+
version: '0'
|
514
514
|
requirements: []
|
515
515
|
rubygems_version: 3.0.8
|
516
516
|
signing_key:
|