You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guide/deferred-props.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,7 @@
1
1
# Deferred props
2
2
3
+
@available_since rails=3.6.0 core=2.0.0
4
+
3
5
Inertia's deferred props feature allows you to defer the loading of certain page data until after the initial page render. This can be useful for improving the perceived performance of your app by allowing the initial page render to happen as quickly as possible.
Copy file name to clipboardExpand all lines: docs/guide/merging-props.md
+30-7Lines changed: 30 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,31 +4,52 @@ By default, Inertia overwrites props with the same name when reloading a page. H
4
4
5
5
## Server side
6
6
7
-
> `deep_merge` requires `@inertiajs/core` v2.0.8 or higher, and `inertia_rails` v3.8.0 or higher.
7
+
### Using `merge`
8
8
9
-
To specify that a prop should be merged, use the `merge` or `deep_merge` method on the prop's value.
9
+
@available_since rails=3.8.0 core=2.0.8
10
10
11
-
Use `merge` for merging simple arrays, and `deep_merge` for handling nested objects that include arrays or complex structures, such as pagination objects.
11
+
To specify that a prop should be merged, use the `merge` method on the prop's value. This is ideal for merging simple arrays.
12
+
13
+
On the client side, Inertia detects that this prop should be merged. If the prop returns an array, it will append the response to the current prop value. If it's an object, it will merge the response with the current prop value.
@@ -41,10 +62,12 @@ class UsersController < ApplicationController
41
62
end
42
63
```
43
64
44
-
On the client side, Inertia detects that this prop should be merged. If the prop returns an array, it will append the response to the current prop value. If it's an object, it will merge the response with the current prop value. If you have opted to `deepMerge`, Inertia ensures a deep merge of the entire structure.
65
+
If you have opted to use `deep_merge`, Inertia ensures a deep merge of the entire structure, including nested objects and arrays.
45
66
46
67
### Smart merging with `match_on`
47
68
69
+
@available_since rails=master core=2.0.13
70
+
48
71
By default, arrays are simply appended during merging. If you need to update specific items in an array or replace them based on a unique identifier, you can use the `match_on` parameter.
49
72
50
73
The `match_on` parameter enables smart merging by specifying a field to match on when merging arrays of objects:
0 commit comments