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
{{ message }}
Repository navigation
Commit 3aecfb8
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: .changeset/populate-sidecar.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,3 +12,4 @@
12
12
13
13
-`get`, `list`, `client.get/list`, the `get`/`list` operations and `get_document` return `relations` unless called with `populate: false`.
14
14
- Populated relations skip trashed documents: a relation to one is `null` (dropped from a `many` array), like a missing document.
15
+
- A relation into a collection the reader can't read is `null` (or `[]`) instead of being left out of `relations`, so hidden and missing targets look the same.
Copy file name to clipboardExpand all lines: docs/api/cms-core-server.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -177,7 +177,7 @@ The canonical reads. One bag each, the same at every layer: the store (`cmsAs(cm
177
177
178
178
A`locator`isthedocument's slug or its id, with leading slashes ignored. A document that is missing, or that `ctx` can'tsee, is`null`from`get`andabsentfrom`list`. Documentsareredactedfor`ctx`, andfilteringorsortingonafielditcan't read is `FORBIDDEN`. Both functions validate the bag (`getInput`, `listInput` from `@tanstack/cms-core`) and throw `BAD_REQUEST` for an invalid one.
179
179
180
-
Bothverbspopulaterelationsbydefault. Therelateddocumentscomebackbesidethedocument, under`relations`, keyedbyrelationfieldpath (`author`, `seo.image`, `blocks.2.author`); `doc`keepstheids. Populationisoneleveldeep: arelateddocument's own relation fields stay ids, so cycles and self-references can'trecurse. Arelateddocumentisreadandredactedas`ctx`readsit. Amissing, trashedorhiddentargetis`null`, ordroppedfroma`many`array, andarelationintoacollection`ctx`can't read is left out. `list` batches the reads: one storage read per target collection for the whole page, not one per row. Pass `populate: false` for ids only, or an array of paths to populate just those (and the relations under them). `related(result, path)` from `@tanstack/cms-core` reads one relation back, typed from `Register`: a registered relation field gives the target'sdocumenttype, oranarrayfor`many: true`.
180
+
Bothverbspopulaterelationsbydefault. Therelateddocumentscomebackbesidethedocument, under`relations`, keyedbyrelationfieldpath (`author`, `seo.image`, `blocks.2.author`); `doc`keepstheids. Populationisoneleveldeep: arelateddocument's own relation fields stay ids, so cycles and self-references can'trecurse. Arelateddocumentisreadandredactedas`ctx`readsit. Amissing, trashedorhiddentargetis`null`, ordroppedfroma`many`array, whetherthedocumentoritswholecollectionishidden, soareadercan't tell hidden from missing. `list` batches the reads: one storage read per target collection for the whole page, not one per row. Pass `populate: false` for ids only, or an array of paths to populate just those (and the relations under them). `related(result, path)` from `@tanstack/cms-core` reads one relation back, typed from `Register`: a registered relation field gives the target'sdocumenttype, oranarrayfor`many: true`.
@@ -390,7 +390,7 @@ function populateRelationsAs(ctx: AccessContext, collectionName: string, doc: Do
390
390
function populateRelations(collectionName: string, doc: Doc): Promise<Record<string, Doc | Array<Doc> | null>> // deprecated: reads as publicContext()
391
391
```
392
392
393
-
Resolvesevery`relation`fieldof`doc`tothetargetdocument(s) `ctx`canread, keyedbyfieldname. Amissing, trashedorhiddentargetis`null` (droppedfroma`many`array). A`publicRead`contextseespublishedtargetsthewayitseespublishedsources. Fieldswhosetargetcollection`ctx`can't read are left out.
393
+
Resolvesevery`relation`fieldof`doc`tothetargetdocument(s) `ctx`canread, keyedbyfieldname. Amissing, trashedorhiddentargetis`null` (droppedfroma`many`array), includingoneinacollection`ctx`can't read. A `publicRead` context sees published targets the way it sees published sources.
0 commit comments