|
| 1 | +--- |
| 2 | +"@objectstack/docs": patch |
| 3 | +--- |
| 4 | + |
| 5 | +docs(react-pages): delete the unreachable `Array.isArray(result)` limb from the live-data sample |
| 6 | + |
| 7 | +`ObjectStackAdapter.find()` cannot resolve to an array, so the `Array.isArray(result)` |
| 8 | +arm the live-data sample carried could never be taken. Re-derived against objectui at |
| 9 | +the sha this repo pins (`9602dc82`) and again at objectui `origin/main`, which agree |
| 10 | +line for line: |
| 11 | + |
| 12 | +- `find()` returns from five points — `{ data: [], total: 0 }` for a resource already |
| 13 | + memoized as missing, `{ data: [], total: 0 }` for a fresh 404 that is not an |
| 14 | + `enable`-block denial, two `normalizeQueryResult(...)` calls (the `$expand`/`$search` |
| 15 | + raw-GET path and the client-SDK path), and `return existing`, which hands back a |
| 16 | + promise produced by that same set. |
| 17 | +- Both branches of `normalizeQueryResult()` return an object literal with exactly |
| 18 | + `data`, `total`, `page`, `pageSize`, `hasMore`. The first branch is the one that |
| 19 | + makes the limb dead: it tests `Array.isArray(result)` on the *transport* response and |
| 20 | + **wraps** a bare array into that envelope. The array case is folded before any caller |
| 21 | + sees it. |
| 22 | + |
| 23 | +The sample now reads `result.data` directly, and a new paragraph under it states the |
| 24 | +envelope contract so the reason survives the next edit. The two `kind:'react'` pages in |
| 25 | +`examples/app-showcase` carrying the same dead limb — `crm-workbench` and |
| 26 | +`renewals-pipeline` — were repaired in the same edit, with the derivation recorded in the |
| 27 | +comment that already explains the neighbouring `.records` trap. |
| 28 | + |
| 29 | +Behaviour-preserving: `.data` was read first and always won. What goes is a shape the |
| 30 | +producer cannot emit, sitting in the page a customer — and a coding agent — copies from. |
0 commit comments