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
This means that, in order to use links mode, a relationship payload given to the cache MUST contain this related link.
@@ -68,6 +70,8 @@ If your API does not provide this link, a [request handler](https://api.emberjs.
68
70
69
71
Note that this approach can even work if your API requires you to send a POST request to fetch the relationship. [This blog post](https://runspired.com/2025/02/26/exploring-advanced-handlers.html) contains an overview of advanced request handling to achieve a similar aim for pagination.
70
72
73
+
<br>
74
+
71
75
### When a Relationship Is Fetched, the Related Link Is Used
72
76
73
77
Fetching a relationship via any of `relationship.reload`, `reference.reload`, `reference.load` or `await record.relationship` will issue a request to your handler chain. That request will look like the following:
@@ -106,12 +110,18 @@ relationship as well.
106
110
107
111
Sideloads (included records) are valid to include in these responses.
108
112
113
+
<br>
114
+
115
+
---
116
+
109
117
## Activating LinksMode
110
118
111
119
LinksMode is activated by adding `linksMode: true` to the relationship's options.
112
120
113
121
Read on below for examples and nuances specific to Model vs SchemaRecord
114
122
123
+
<br>
124
+
115
125
### For a Relationship on a Model
116
126
117
127
```ts
@@ -129,6 +139,8 @@ export default class User extends Model {
129
139
130
140
This works for both `async` and `non-async` relationships and only changes the fetching behavior of the field it is defined on. For instance, in the example above, `homeAddress` is fetched in links mode while `<Address>.residents` might still be using the legacy adapter experience.
131
141
142
+
<br>
143
+
132
144
### For a SchemaRecord in LegacyMode
133
145
134
146
```ts
@@ -155,6 +167,8 @@ const UserSchema = {
155
167
The behavior of a relationship for a SchemaRecord in LegacyMode is always identical to that of a the same
156
168
relationship defined on a Model.
157
169
170
+
<br>
171
+
158
172
### For a SchemaRecord in PolarisMode
159
173
160
174
```ts
@@ -199,6 +213,10 @@ In the meantime, we've enabled synchronous linksMode relationships in order to a
199
213
If this limitation is too great we would recommend continuing to use `LegacyMode` until the full story for
200
214
relationships in PolarisMode is shipped.
201
215
216
+
<br>
217
+
218
+
---
219
+
202
220
#### What To Expect from PolarisMode Relationships in the Future
203
221
204
222
We intend to replace `belongsTo` and `hasMany` fields with the (as yet not implemented)
0 commit comments