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/partial-reloads.md
+49-1Lines changed: 49 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,6 +46,8 @@ router.visit(url, {
46
46
47
47
## Except certain props
48
48
49
+
In addition to the only visit option you can also use the except option to specify which data the server should exclude. This option should also be an array of keys which correspond to the keys of the props.
50
+
49
51
:::tabs key:frameworks
50
52
== Vue
51
53
@@ -79,7 +81,53 @@ router.visit(url, {
79
81
80
82
:::
81
83
82
-
In addition to the only visit option you can also use the except option to specify which data the server should exclude. This option should also be an array of keys which correspond to the keys of the props.
84
+
## Dot notation
85
+
86
+
Both the `only` and `except` visit options support dot notation to specify nested data, and they can be used together. In the following example, only `settings.theme` will be rendered, but without its `colors` property.
87
+
88
+
:::tabs key:frameworks
89
+
== Vue
90
+
91
+
```js
92
+
import { router } from'@inertiajs/vue3'
93
+
94
+
router.visit(url, {
95
+
only: ['settings.theme'],
96
+
except: ['setting.theme.colors'],
97
+
})
98
+
```
99
+
100
+
== React
101
+
102
+
```jsx
103
+
import { router } from'@inertiajs/react'
104
+
105
+
router.visit(url, {
106
+
only: ['settings.theme'],
107
+
except: ['setting.theme.colors'],
108
+
})
109
+
```
110
+
111
+
== Svelte 4|Svelte 5
112
+
113
+
```js
114
+
import { router } from'@inertiajs/svelte'
115
+
116
+
router.visit(url, {
117
+
only: ['settings.theme'],
118
+
except: ['setting.theme.colors'],
119
+
})
120
+
```
121
+
122
+
Please remember that, by design, partial reloading filters props _before_ they are evaluated, so it can only target explicitly defined prop keys. Let's say you have this prop:
123
+
124
+
`users: -> { User.all }`
125
+
126
+
Requesting `only: ['users.name']` will exclude the entire `users` prop, since `users.name` is not available before evaluating the prop.
127
+
128
+
Requesting `except: ['users.name']` will not exclude anything.
0 commit comments