Skip to content

Commit a7569d8

Browse files
authored
Merge pull request #10 from llamadeus/documentation-fixes
Await watch call
2 parents 738471d + e328aa0 commit a7569d8

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

packages/docs/src/pages/docs/changes.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ very fast, there is a better alternative.
1414
(The callback will also be called once with all items in the table right after you register your watcher).
1515

1616
```ts
17-
const dispose = watch(userTable, users => {
17+
const dispose = await watch(userTable, users => {
1818
console.log('All users', users);
1919
});
2020
```
@@ -23,7 +23,7 @@ Only retrieving certain items from the table is also possible - just provide a [
2323
and your callback will only be called if items matching the filter are inserted/updated/deleted.
2424

2525
```ts
26-
const dispose = watch(userTable, { where: { age: { lt: 3 } } }, babies => {
26+
const dispose = await watch(userTable, { where: { age: { lt: 3 } } }, babies => {
2727
console.log('All babies: ', babies);
2828
});
2929
```
@@ -32,4 +32,4 @@ If you want to stop receiving updates, call the function returned from [`watch()
3232

3333
```ts
3434
dispose();
35-
```
35+
```

packages/docs/src/pages/docs/index.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,14 @@ resulting in incredible performance, regardless if you're working with **10.000*
9797
</div>
9898
```ts
9999
// Either watch for changes on the whole table...
100-
watch(userTable, users => {
100+
await watch(userTable, users => {
101101
console.log('All users in the database:', users);
102102
});
103103

104104
// ...or specify a filter
105-
watch(userTable, { where: { age: { lt: 5 } } }, babies => {
105+
await watch(userTable, { where: { age: { lt: 5 } } }, babies => {
106106
console.log('All babies in the database:', babies);
107107
});
108108
```
109109
</div>
110-
</div>
110+
</div>

packages/docs/src/pages/docs/reference/watch.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ It's perfect for usage inside reactive components like React Hooks.
1414

1515
```ts
1616
// Call `callback` whenever ALL entities change
17-
watch(userTable, (users) => {
17+
await watch(userTable, (users) => {
1818
console.log("All users: ", users);
1919
});
2020
// Call `callback` whenever an item matching the filter changes
21-
watch(userTable, { where: { age: { lt: 3 } } }, (babies) => {
21+
await watch(userTable, { where: { age: { lt: 3 } } }, (babies) => {
2222
console.log("All babies: ", babies);
2323
});
2424
```
@@ -34,10 +34,10 @@ watch(userTable, { where: { age: { lt: 3 } } }, (babies) => {
3434
If you want to stop watching for changes, call the function returned by `watch()`.
3535

3636
```ts
37-
const stop = watch(userTable, (users) => {
37+
const stop = await watch(userTable, (users) => {
3838
console.log("All users: ", users);
3939
});
4040

4141
// Stop watching changes
4242
stop();
43-
```
43+
```

0 commit comments

Comments
 (0)