Skip to content

Commit 482f7e2

Browse files
committed
update config
1 parent 3b38b8b commit 482f7e2

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

docs/docs/query-public-data.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,36 @@ const { data, isPending, isError } = useEntities(Event, {
6262

6363
For deeper relations you can use the `include` parameter multiple levels deep. Currently two levels of relations are supported for public data.
6464

65+
#### Controlling include scopes with `_config`
66+
67+
Each branch within `include` can optionally carry a `_config` object that lets you override which spaces Hypergraph will inspect for the relation edges and the related entity values. When you omit `_config`, the query automatically reuses the `space`/`spaces` selection you passed to `useEntities`, `useEntity`, `Entity.findOnePublic`, `Entity.findManyPublic` and `Entity.searchManyPublic` helpers.
68+
69+
```ts
70+
const { data: project } = useEntity(Project, {
71+
id: '9f130661-8c3f-4db7-9bdc-3ce69631c5ef',
72+
mode: 'public',
73+
space: '3f32353d-3b27-4a13-b71a-746f06e1f7db',
74+
include: {
75+
contributors: {
76+
_config: {
77+
relationSpaces: ['3f32353d-3b27-4a13-b71a-746f06e1f7db', '95a4a1cc-bfcc-4038-b7a1-02c513d27700'],
78+
valueSpaces: 'all',
79+
},
80+
organizations: {
81+
_config: {
82+
valueSpaces: ['95a4a1cc-bfcc-4038-b7a1-02c513d27700'],
83+
},
84+
},
85+
},
86+
},
87+
});
88+
```
89+
90+
- `relationSpaces` controls which spaces are searched for the relation edges themselves (`relations`/`backlinks`). Pass an array to whitelist specific spaces, `'all'` to drop the filter entirely, or `[]` if you intentionally want the branch to match nothing.
91+
- `valueSpaces` applies the same override to the `valuesList` lookups for the related entities. This lets you fetch relation edges from one space while trusting the canonical values that live in another.
92+
93+
Overrides cascade to nested branches, so you can attach `_config` anywhere within the two supported include levels. Mix and match the settings per branch to stitch together data that spans multiple public spaces without issuing separate queries.
94+
6595
### Querying from a specific space
6696

6797
You can also query from a specific space by passing in the `space` parameter.

0 commit comments

Comments
 (0)