Skip to content

Commit 597e9eb

Browse files
committed
docs: Use Collection for relational data example
1 parent d974419 commit 597e9eb

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

.github/instructions/manager.instructions.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ export default class LoggingManager implements Manager {
7070
}
7171
```
7272

73-
`actionTypes`: FETCH, SET, SET_RESPONSE, RESET, SUBSCRIBE, UNSUBSCRIBE, INVALIDATE, INVALIDATEALL, EXPIREALL
73+
Always use `actionTypes` members to check action.type.
74+
`actionTypes` has: FETCH, SET, SET_RESPONSE, RESET, SUBSCRIBE, UNSUBSCRIBE, INVALIDATE, INVALIDATEALL, EXPIREALL
7475

7576
[actions](https://dataclient.io/docs/api/Actions) docs details the action types and their payloads.
7677

docs/rest/guides/relational-data.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,11 @@ export class Post extends Entity {
120120

121121
static schema = {
122122
author: User,
123-
comments: [Comment],
123+
comments: new schema.Collection([Comment], {
124+
nestKey: (parent, key) => ({
125+
postId: parent.id,
126+
}),
127+
}),
124128
};
125129
}
126130

examples/coin-app/src/resources/StreamManager.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ import type { Entity } from '@data-client/rest';
77
* https://docs.cloud.coinbase.com/advanced-trade-api/docs/ws-overview
88
*/
99
export default class StreamManager implements Manager {
10-
protected declare evtSource: WebSocket; // | EventSource;
11-
protected declare createEventSource: () => WebSocket; // | EventSource;
12-
protected declare entities: Record<string, typeof Entity>;
10+
declare protected evtSource: WebSocket; // | EventSource;
11+
declare protected createEventSource: () => WebSocket; // | EventSource;
12+
declare protected entities: Record<string, typeof Entity>;
1313
protected msgQueue: (string | ArrayBufferLike | Blob | ArrayBufferView)[] =
1414
[];
1515

1616
protected product_ids: string[] = [];
1717
private attempts = 0;
18-
protected declare controller: Controller;
18+
declare protected controller: Controller;
1919

2020
constructor(
2121
evtSource: () => WebSocket, // | EventSource,

0 commit comments

Comments
 (0)