Commit bbdfdb8
authored
fix(ui): prevent NaN page parameter in polymorphic relationship pagination (#14795)
### What
Fixed pagination bug in polymorphic relationship fields where the second
collection type would fail to load additional pages due to sending
`page=NaN` in the request.
### Why
When paginating through a polymorphic relationship dropdown,
`lastLoadedPageArg[relation]` was `undefined` for collections that
hadn't been loaded yet. This caused the page parameter to become `NaN`
(`undefined + 1 = NaN`), breaking pagination for subsequent collection
types.
### How
Added a fallback to default to `0` when the relation hasn't been
paginated yet:
```typescript
lastLoadedPageToUse = (lastLoadedPageArg[relation] || 0) + 1
```
Fixes #147541 parent 61f5aee commit bbdfdb8
File tree
2 files changed
+58
-1
lines changed- packages/ui/src/fields/Relationship
- test/fields-relationship
2 files changed
+58
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
227 | 227 | | |
228 | 228 | | |
229 | 229 | | |
230 | | - | |
| 230 | + | |
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
284 | 284 | | |
285 | 285 | | |
286 | 286 | | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
287 | 344 | | |
288 | 345 | | |
289 | 346 | | |
| |||
0 commit comments