@dxos/react-client 0.4.10-main.3e35a2f → 0.4.10-main.3f5e2d2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/{chunk-6SW7V4VI.mjs → chunk-HJDLXXEZ.mjs} +3 -3
- package/dist/lib/browser/{chunk-6SW7V4VI.mjs.map → chunk-HJDLXXEZ.mjs.map} +3 -3
- package/dist/lib/browser/devtools/index.mjs +1 -1
- package/dist/lib/browser/echo/index.mjs +27 -16
- package/dist/lib/browser/echo/index.mjs.map +3 -3
- package/dist/lib/browser/halo/index.mjs +11 -23
- package/dist/lib/browser/halo/index.mjs.map +3 -3
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/mesh/index.mjs +3 -7
- package/dist/lib/browser/mesh/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +1 -1
- package/dist/lib/browser/testing/index.mjs.map +2 -2
- package/dist/lib/node/{chunk-IRRRZ2KE.cjs → chunk-3GRHATJ3.cjs} +5 -5
- package/dist/lib/node/{chunk-IRRRZ2KE.cjs.map → chunk-3GRHATJ3.cjs.map} +3 -3
- package/dist/lib/node/devtools/index.cjs +2 -2
- package/dist/lib/node/echo/index.cjs +28 -17
- package/dist/lib/node/echo/index.cjs.map +3 -3
- package/dist/lib/node/halo/index.cjs +16 -29
- package/dist/lib/node/halo/index.cjs.map +3 -3
- package/dist/lib/node/index.cjs +9 -9
- package/dist/lib/node/mesh/index.cjs +4 -8
- package/dist/lib/node/mesh/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +2 -2
- package/dist/lib/node/testing/index.cjs.map +2 -2
- package/dist/types/src/echo/useQuery.d.ts +2 -2
- package/dist/types/src/echo/useQuery.d.ts.map +1 -1
- package/dist/types/src/echo/useSpaceInvitations.d.ts +2 -1
- package/dist/types/src/echo/useSpaceInvitations.d.ts.map +1 -1
- package/dist/types/src/halo/index.d.ts +1 -1
- package/dist/types/src/halo/index.d.ts.map +1 -1
- package/dist/types/src/halo/useContacts.d.ts.map +1 -1
- package/dist/types/src/halo/useDevices.d.ts.map +1 -1
- package/dist/types/src/halo/useHaloInvitations.d.ts +2 -1
- package/dist/types/src/halo/useHaloInvitations.d.ts.map +1 -1
- package/dist/types/src/mesh/useNetworkStatus.d.ts.map +1 -1
- package/dist/types/src/testing/ClientRepeater.d.ts.map +1 -1
- package/package.json +33 -25
- package/project.json +3 -0
- package/src/client/useAgentHostingProvider.ts +2 -2
- package/src/echo/useQuery.ts +41 -14
- package/src/echo/useSpaceInvitations.ts +6 -18
- package/src/halo/index.ts +1 -10
- package/src/halo/useContacts.ts +2 -11
- package/src/halo/useDevices.ts +2 -11
- package/src/halo/useHaloInvitations.ts +6 -13
- package/src/mesh/useNetworkStatus.ts +2 -11
- package/src/testing/ClientRepeater.tsx +2 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-client",
|
|
3
|
-
"version": "0.4.10-main.
|
|
3
|
+
"version": "0.4.10-main.3f5e2d2",
|
|
4
4
|
"description": "React client API",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -11,49 +11,57 @@
|
|
|
11
11
|
"browser": "./dist/lib/browser/index.mjs",
|
|
12
12
|
"import": "./dist/lib/browser/index.mjs",
|
|
13
13
|
"require": "./dist/lib/node/index.cjs",
|
|
14
|
-
"node": "./dist/lib/node/index.cjs"
|
|
14
|
+
"node": "./dist/lib/node/index.cjs",
|
|
15
|
+
"types": "./dist/types/src/index.d.ts"
|
|
15
16
|
},
|
|
16
17
|
"./devtools": {
|
|
17
18
|
"browser": "./dist/lib/browser/devtools/index.mjs",
|
|
18
19
|
"import": "./dist/lib/browser/devtools/index.mjs",
|
|
19
20
|
"require": "./dist/lib/node/devtools/index.cjs",
|
|
20
|
-
"node": "./dist/lib/node/devtools/index.cjs"
|
|
21
|
+
"node": "./dist/lib/node/devtools/index.cjs",
|
|
22
|
+
"types": "./dist/types/src/devtools/index.d.ts"
|
|
21
23
|
},
|
|
22
24
|
"./echo": {
|
|
23
25
|
"browser": "./dist/lib/browser/echo/index.mjs",
|
|
24
26
|
"import": "./dist/lib/browser/echo/index.mjs",
|
|
25
27
|
"require": "./dist/lib/node/echo/index.cjs",
|
|
26
|
-
"node": "./dist/lib/node/echo/index.cjs"
|
|
28
|
+
"node": "./dist/lib/node/echo/index.cjs",
|
|
29
|
+
"types": "./dist/types/src/echo/index.d.ts"
|
|
27
30
|
},
|
|
28
31
|
"./halo": {
|
|
29
32
|
"browser": "./dist/lib/browser/halo/index.mjs",
|
|
30
33
|
"import": "./dist/lib/browser/halo/index.mjs",
|
|
31
34
|
"require": "./dist/lib/node/halo/index.cjs",
|
|
32
|
-
"node": "./dist/lib/node/halo/index.cjs"
|
|
35
|
+
"node": "./dist/lib/node/halo/index.cjs",
|
|
36
|
+
"types": "./dist/types/src/halo/index.d.ts"
|
|
33
37
|
},
|
|
34
38
|
"./invitations": {
|
|
35
39
|
"browser": "./dist/lib/browser/invitations/index.mjs",
|
|
36
40
|
"import": "./dist/lib/browser/invitations/index.mjs",
|
|
37
41
|
"require": "./dist/lib/node/invitations/index.cjs",
|
|
38
|
-
"node": "./dist/lib/node/invitations/index.cjs"
|
|
42
|
+
"node": "./dist/lib/node/invitations/index.cjs",
|
|
43
|
+
"types": "./dist/types/src/invitations/index.d.ts"
|
|
39
44
|
},
|
|
40
45
|
"./mesh": {
|
|
41
46
|
"browser": "./dist/lib/browser/mesh/index.mjs",
|
|
42
47
|
"import": "./dist/lib/browser/mesh/index.mjs",
|
|
43
48
|
"require": "./dist/lib/node/mesh/index.cjs",
|
|
44
|
-
"node": "./dist/lib/node/mesh/index.cjs"
|
|
49
|
+
"node": "./dist/lib/node/mesh/index.cjs",
|
|
50
|
+
"types": "./dist/types/src/mesh/index.d.ts"
|
|
45
51
|
},
|
|
46
52
|
"./testing": {
|
|
47
53
|
"browser": "./dist/lib/browser/testing/index.mjs",
|
|
48
54
|
"import": "./dist/lib/browser/testing/index.mjs",
|
|
49
55
|
"require": "./dist/lib/node/testing/index.cjs",
|
|
50
|
-
"node": "./dist/lib/node/testing/index.cjs"
|
|
56
|
+
"node": "./dist/lib/node/testing/index.cjs",
|
|
57
|
+
"types": "./dist/types/src/testing/index.d.ts"
|
|
51
58
|
},
|
|
52
59
|
"./worker": {
|
|
53
60
|
"browser": "./dist/lib/browser/worker.mjs",
|
|
54
61
|
"import": "./dist/lib/browser/worker.mjs",
|
|
55
62
|
"require": "./dist/lib/node/worker.cjs",
|
|
56
|
-
"node": "./dist/lib/node/worker.cjs"
|
|
63
|
+
"node": "./dist/lib/node/worker.cjs",
|
|
64
|
+
"types": "./dist/types/src/worker.d.ts"
|
|
57
65
|
}
|
|
58
66
|
},
|
|
59
67
|
"types": "dist/types/src/index.d.ts",
|
|
@@ -83,17 +91,17 @@
|
|
|
83
91
|
}
|
|
84
92
|
},
|
|
85
93
|
"dependencies": {
|
|
86
|
-
"@dxos/async": "0.4.10-main.
|
|
87
|
-
"@dxos/client": "0.4.10-main.
|
|
88
|
-
"@dxos/codec-protobuf": "0.4.10-main.
|
|
89
|
-
"@dxos/
|
|
90
|
-
"@dxos/
|
|
91
|
-
"@dxos/
|
|
92
|
-
"@dxos/
|
|
93
|
-
"@dxos/
|
|
94
|
-
"@dxos/
|
|
95
|
-
"@dxos/
|
|
96
|
-
"@dxos/
|
|
94
|
+
"@dxos/async": "0.4.10-main.3f5e2d2",
|
|
95
|
+
"@dxos/client": "0.4.10-main.3f5e2d2",
|
|
96
|
+
"@dxos/codec-protobuf": "0.4.10-main.3f5e2d2",
|
|
97
|
+
"@dxos/echo-signals": "0.4.10-main.3f5e2d2",
|
|
98
|
+
"@dxos/debug": "0.4.10-main.3f5e2d2",
|
|
99
|
+
"@dxos/config": "0.4.10-main.3f5e2d2",
|
|
100
|
+
"@dxos/invariant": "0.4.10-main.3f5e2d2",
|
|
101
|
+
"@dxos/log": "0.4.10-main.3f5e2d2",
|
|
102
|
+
"@dxos/react-async": "0.4.10-main.3f5e2d2",
|
|
103
|
+
"@dxos/util": "0.4.10-main.3f5e2d2",
|
|
104
|
+
"@dxos/node-std": "0.4.10-main.3f5e2d2"
|
|
97
105
|
},
|
|
98
106
|
"devDependencies": {
|
|
99
107
|
"@testing-library/dom": "^8.17.1",
|
|
@@ -104,10 +112,10 @@
|
|
|
104
112
|
"react": "^18.2.0",
|
|
105
113
|
"react-dom": "^18.2.0",
|
|
106
114
|
"yjs": "^13.6.10",
|
|
107
|
-
"@dxos/
|
|
108
|
-
"@dxos/react-ui": "0.4.10-main.
|
|
109
|
-
"@dxos/
|
|
110
|
-
"@dxos/storybook-utils": "0.4.10-main.
|
|
115
|
+
"@dxos/random": "0.4.10-main.3f5e2d2",
|
|
116
|
+
"@dxos/react-ui": "0.4.10-main.3f5e2d2",
|
|
117
|
+
"@dxos/react-ui-theme": "0.4.10-main.3f5e2d2",
|
|
118
|
+
"@dxos/storybook-utils": "0.4.10-main.3f5e2d2"
|
|
111
119
|
},
|
|
112
120
|
"peerDependencies": {
|
|
113
121
|
"react": "*",
|
|
@@ -115,7 +123,7 @@
|
|
|
115
123
|
},
|
|
116
124
|
"optionalDependencies": {
|
|
117
125
|
"yjs": "^13.6.10",
|
|
118
|
-
"@dxos/random": "0.4.10-main.
|
|
126
|
+
"@dxos/random": "0.4.10-main.3f5e2d2"
|
|
119
127
|
},
|
|
120
128
|
"publishConfig": {
|
|
121
129
|
"access": "public"
|
package/project.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
6
|
type AgentHostingProviderClient,
|
|
7
|
-
|
|
7
|
+
DXOSAgentHostingProviderClient,
|
|
8
8
|
FakeAgentHostingProvider,
|
|
9
9
|
} from '@dxos/client/services';
|
|
10
10
|
import { type Config } from '@dxos/config';
|
|
@@ -33,5 +33,5 @@ export const useAgentHostingProviderClient = (config: Config): AgentHostingProvi
|
|
|
33
33
|
return new FakeAgentHostingProvider(config);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
return new
|
|
36
|
+
return new DXOSAgentHostingProviderClient(config);
|
|
37
37
|
};
|
package/src/echo/useQuery.ts
CHANGED
|
@@ -4,34 +4,57 @@
|
|
|
4
4
|
|
|
5
5
|
import { useMemo, useSyncExternalStore } from 'react';
|
|
6
6
|
|
|
7
|
-
import
|
|
7
|
+
import {
|
|
8
|
+
type QueryOptions,
|
|
9
|
+
type Query,
|
|
10
|
+
type FilterSource,
|
|
11
|
+
type Space,
|
|
12
|
+
type EchoReactiveObject,
|
|
13
|
+
type Echo,
|
|
14
|
+
isSpace,
|
|
15
|
+
} from '@dxos/client/echo';
|
|
8
16
|
|
|
9
17
|
type UseQuery = {
|
|
10
|
-
<T extends
|
|
18
|
+
<T extends EchoReactiveObject<any>>(
|
|
19
|
+
spaceOrEcho?: Space | Echo,
|
|
20
|
+
filter?: FilterSource<T>,
|
|
21
|
+
options?: QueryOptions,
|
|
22
|
+
deps?: any[],
|
|
23
|
+
): T[];
|
|
11
24
|
};
|
|
12
25
|
|
|
13
26
|
/**
|
|
14
27
|
* Create subscription.
|
|
15
28
|
*/
|
|
16
29
|
// TODO(burdon): Support typed operator filters (e.g., Note.filter(note => ...)).
|
|
17
|
-
export const useQuery: UseQuery = <T extends
|
|
18
|
-
|
|
30
|
+
export const useQuery: UseQuery = <T extends EchoReactiveObject<any>>(
|
|
31
|
+
spaceOrEcho?: Space | Echo,
|
|
19
32
|
filter?: FilterSource<T>,
|
|
20
33
|
options?: QueryOptions,
|
|
21
34
|
deps?: any[],
|
|
22
35
|
) => {
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
36
|
+
const { subscribe, getObjects } = useMemo(() => {
|
|
37
|
+
const query = isSpace(spaceOrEcho)
|
|
38
|
+
? spaceOrEcho.db.query(filter, options)
|
|
39
|
+
: (spaceOrEcho?.query(filter, options) as Query<T> | undefined);
|
|
40
|
+
let subscribed = false;
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
subscribe: (cb: () => void) => {
|
|
44
|
+
subscribed = true;
|
|
45
|
+
const unsubscribe = query?.subscribe(cb) ?? noop;
|
|
46
|
+
return () => {
|
|
47
|
+
unsubscribe?.();
|
|
48
|
+
subscribed = false;
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
getObjects: () => (subscribed && query ? query.objects : EMPTY_ARRAY),
|
|
52
|
+
};
|
|
53
|
+
}, [spaceOrEcho, ...(typeof filter === 'function' ? [] : filterToDepsArray(filter)), ...(deps ?? [])]);
|
|
27
54
|
|
|
28
55
|
// https://beta.reactjs.org/reference/react/useSyncExternalStore
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
(cb) => query?.subscribe?.(cb) ?? cb,
|
|
32
|
-
() => query?.objects,
|
|
33
|
-
) ?? []
|
|
34
|
-
);
|
|
56
|
+
// NOTE: This hook will resubscribe whenever the callback passed to the first argument changes -- make sure it is stable.
|
|
57
|
+
return useSyncExternalStore<T[] | undefined>(subscribe, getObjects) ?? [];
|
|
35
58
|
};
|
|
36
59
|
|
|
37
60
|
// TODO(dmaretskyi): Serialize the filter here instead.
|
|
@@ -39,3 +62,7 @@ const filterToDepsArray = (filter?: FilterSource<any>) =>
|
|
|
39
62
|
Object.entries(filter ?? {})
|
|
40
63
|
.flat(10)
|
|
41
64
|
.map((x) => (typeof x === 'function' || typeof x === 'object' ? null : x));
|
|
65
|
+
|
|
66
|
+
const noop = () => {};
|
|
67
|
+
|
|
68
|
+
const EMPTY_ARRAY: never[] = [];
|
|
@@ -2,30 +2,18 @@
|
|
|
2
2
|
// Copyright 2022 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { useMemo
|
|
5
|
+
import { useMemo } from 'react';
|
|
6
6
|
|
|
7
|
+
import { MulticastObservable } from '@dxos/async';
|
|
7
8
|
import { type PublicKey } from '@dxos/client';
|
|
8
|
-
import {
|
|
9
|
+
import { useMulticastObservable } from '@dxos/react-async';
|
|
9
10
|
|
|
10
11
|
import { useSpace } from './useSpaces';
|
|
11
|
-
import { useInvitationStatus } from '../invitations';
|
|
12
|
+
import { type CancellableInvitationObservable, useInvitationStatus } from '../invitations';
|
|
12
13
|
|
|
13
|
-
export const useSpaceInvitations = (spaceKey?: PublicKey) => {
|
|
14
|
+
export const useSpaceInvitations = (spaceKey?: PublicKey): CancellableInvitationObservable[] => {
|
|
14
15
|
const space = useSpace(spaceKey);
|
|
15
|
-
|
|
16
|
-
useSyncExternalStore(
|
|
17
|
-
(listener) => {
|
|
18
|
-
if (!(space instanceof SpaceProxy)) {
|
|
19
|
-
return () => {};
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const subscription = space.invitations.subscribe(() => listener());
|
|
23
|
-
return () => subscription.unsubscribe();
|
|
24
|
-
},
|
|
25
|
-
() => space?.invitations.get(),
|
|
26
|
-
) ?? [];
|
|
27
|
-
|
|
28
|
-
return invitations;
|
|
16
|
+
return useMulticastObservable(space?.invitations ?? MulticastObservable.empty()) ?? [];
|
|
29
17
|
};
|
|
30
18
|
|
|
31
19
|
export const useSpaceInvitation = (spaceKey?: PublicKey, invitationId?: string) => {
|
package/src/halo/index.ts
CHANGED
|
@@ -3,16 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
// NOTE: Export * fails here.
|
|
6
|
-
export {
|
|
7
|
-
type Contact,
|
|
8
|
-
Device,
|
|
9
|
-
DeviceKind,
|
|
10
|
-
DeviceType,
|
|
11
|
-
type Identity,
|
|
12
|
-
// generateSeedPhrase,
|
|
13
|
-
type Halo,
|
|
14
|
-
HaloProxy,
|
|
15
|
-
} from '@dxos/client/halo';
|
|
6
|
+
export { type Contact, type Identity, type Halo, Device, DeviceKind, DeviceType } from '@dxos/client/halo';
|
|
16
7
|
|
|
17
8
|
export * from './useContacts';
|
|
18
9
|
export * from './useDevices';
|
package/src/halo/useContacts.ts
CHANGED
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
// Copyright 2020 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { useSyncExternalStore } from 'react';
|
|
6
|
-
|
|
7
5
|
import type { Contact } from '@dxos/client/halo';
|
|
6
|
+
import { useMulticastObservable } from '@dxos/react-async';
|
|
8
7
|
|
|
9
8
|
import { useClient } from '../client';
|
|
10
9
|
|
|
@@ -15,13 +14,5 @@ import { useClient } from '../client';
|
|
|
15
14
|
*/
|
|
16
15
|
export const useContacts = (): Contact[] => {
|
|
17
16
|
const client = useClient();
|
|
18
|
-
|
|
19
|
-
(listener) => {
|
|
20
|
-
const subscription = client.halo.contacts.subscribe(listener);
|
|
21
|
-
return () => subscription.unsubscribe();
|
|
22
|
-
},
|
|
23
|
-
() => client.halo.contacts.get(),
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
return contacts;
|
|
17
|
+
return useMulticastObservable(client.halo.contacts);
|
|
27
18
|
};
|
package/src/halo/useDevices.ts
CHANGED
|
@@ -2,21 +2,12 @@
|
|
|
2
2
|
// Copyright 2020 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { useSyncExternalStore } from 'react';
|
|
6
|
-
|
|
7
5
|
import type { Device } from '@dxos/client/halo';
|
|
6
|
+
import { useMulticastObservable } from '@dxos/react-async';
|
|
8
7
|
|
|
9
8
|
import { useClient } from '../client';
|
|
10
9
|
|
|
11
10
|
export const useDevices = (): Device[] => {
|
|
12
11
|
const client = useClient();
|
|
13
|
-
|
|
14
|
-
(listener) => {
|
|
15
|
-
const subscription = client.halo.devices.subscribe(listener);
|
|
16
|
-
return () => subscription.unsubscribe();
|
|
17
|
-
},
|
|
18
|
-
() => client.halo.devices.get(),
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
return devices;
|
|
12
|
+
return useMulticastObservable(client.halo.devices);
|
|
22
13
|
};
|
|
@@ -2,23 +2,16 @@
|
|
|
2
2
|
// Copyright 2022 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { useMemo
|
|
5
|
+
import { useMemo } from 'react';
|
|
6
|
+
|
|
7
|
+
import { useMulticastObservable } from '@dxos/react-async';
|
|
6
8
|
|
|
7
9
|
import { useClient } from '../client';
|
|
8
|
-
import { useInvitationStatus } from '../invitations';
|
|
10
|
+
import { useInvitationStatus, type CancellableInvitationObservable } from '../invitations';
|
|
9
11
|
|
|
10
|
-
export const useHaloInvitations = () => {
|
|
12
|
+
export const useHaloInvitations = (): CancellableInvitationObservable[] => {
|
|
11
13
|
const client = useClient();
|
|
12
|
-
|
|
13
|
-
useSyncExternalStore(
|
|
14
|
-
(listener) => {
|
|
15
|
-
const subscription = client.halo.invitations.subscribe(() => listener());
|
|
16
|
-
return () => subscription.unsubscribe();
|
|
17
|
-
},
|
|
18
|
-
() => (client.halo.opened ? client.halo.invitations.get() : []),
|
|
19
|
-
) ?? [];
|
|
20
|
-
|
|
21
|
-
return invitations;
|
|
14
|
+
return useMulticastObservable(client.halo.invitations);
|
|
22
15
|
};
|
|
23
16
|
|
|
24
17
|
export const useHaloInvitation = (invitationId?: string) => {
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
// Copyright 2020 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { useSyncExternalStore } from 'react';
|
|
6
|
-
|
|
7
5
|
import { type NetworkStatus } from '@dxos/client/mesh';
|
|
6
|
+
import { useMulticastObservable } from '@dxos/react-async';
|
|
8
7
|
|
|
9
8
|
import { useClient } from '../client';
|
|
10
9
|
|
|
@@ -13,13 +12,5 @@ import { useClient } from '../client';
|
|
|
13
12
|
*/
|
|
14
13
|
export const useNetworkStatus = (): NetworkStatus => {
|
|
15
14
|
const client = useClient();
|
|
16
|
-
|
|
17
|
-
(listener) => {
|
|
18
|
-
const subscription = client.mesh.networkStatus.subscribe(listener);
|
|
19
|
-
return () => subscription.unsubscribe();
|
|
20
|
-
},
|
|
21
|
-
() => client.mesh.networkStatus.get(),
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
return networkStatus;
|
|
15
|
+
return useMulticastObservable(client.mesh.networkStatus);
|
|
25
16
|
};
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import React, { useState, type FC, useEffect } from 'react';
|
|
6
6
|
|
|
7
7
|
import { Client, type PublicKey } from '@dxos/client';
|
|
8
|
-
import { type
|
|
8
|
+
import { type Space } from '@dxos/client/echo';
|
|
9
9
|
import { TestBuilder, performInvitation } from '@dxos/client/testing';
|
|
10
10
|
import { registerSignalFactory } from '@dxos/echo-signals/react';
|
|
11
11
|
import { faker } from '@dxos/random';
|
|
@@ -72,9 +72,7 @@ export const ClientRepeater = <P extends RepeatedComponentProps>(props: ClientRe
|
|
|
72
72
|
const space = await clients[0].spaces.create({ name: faker.commerce.productName() });
|
|
73
73
|
setSpaceKey(space.key);
|
|
74
74
|
await onCreateSpace?.(space);
|
|
75
|
-
await Promise.all(
|
|
76
|
-
clients.slice(1).map((client) => performInvitation({ host: space as SpaceProxy, guest: client.spaces })),
|
|
77
|
-
);
|
|
75
|
+
await Promise.all(clients.slice(1).map((client) => performInvitation({ host: space, guest: client.spaces })));
|
|
78
76
|
}
|
|
79
77
|
|
|
80
78
|
setClients(clients);
|