@dxos/react-client 2.19.2 → 2.19.3-dev.1f602c0c

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/react-client",
3
- "version": "2.19.2",
3
+ "version": "2.19.3-dev.1f602c0c",
4
4
  "description": "React client API",
5
5
  "keywords": [],
6
6
  "license": "AGPL-3.0",
@@ -15,16 +15,16 @@
15
15
  "test": "toolchain test"
16
16
  },
17
17
  "dependencies": {
18
- "@dxos/async": "2.19.2",
19
- "@dxos/client": "2.19.2",
20
- "@dxos/config": "2.19.2",
21
- "@dxos/credentials": "2.19.2",
22
- "@dxos/crypto": "2.19.2",
23
- "@dxos/debug": "2.19.2",
24
- "@dxos/echo-db": "2.19.2",
25
- "@dxos/esbuild-plugins": "2.19.2",
18
+ "@dxos/async": "2.19.3-dev.1f602c0c",
19
+ "@dxos/client": "2.19.3-dev.1f602c0c",
20
+ "@dxos/config": "2.19.3-dev.1f602c0c",
21
+ "@dxos/credentials": "2.19.3-dev.1f602c0c",
22
+ "@dxos/crypto": "2.19.3-dev.1f602c0c",
23
+ "@dxos/debug": "2.19.3-dev.1f602c0c",
24
+ "@dxos/echo-db": "2.19.3-dev.1f602c0c",
25
+ "@dxos/esbuild-plugins": "2.19.3-dev.1f602c0c",
26
26
  "@dxos/esbuild-server": "~1.4.1",
27
- "@dxos/util": "2.19.2",
27
+ "@dxos/util": "2.19.3-dev.1f602c0c",
28
28
  "@types/debug": "^4.1.7",
29
29
  "assert": "^2.0.0",
30
30
  "debug": "^4.3.3",
@@ -1,33 +0,0 @@
1
- Invoking: toolchain build:test
2
-
3
-
4
- typescript
5
- OK in 3684 ms
6
-
7
- eslint
8
- OK in 7663 ms
9
-
10
- mocha
11
- This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills
12
- This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills
13
-
14
-
15
- ClientProvider
16
- ✓ Renders with children (39ms)
17
- ✓ Provides the client
18
-
19
- Client hook
20
- ✓ should throw when used outside a context
21
- ✓ should return client when used properly in a context
22
-
23
- Config hook
24
- ✓ should throw when used outside a context
25
- ✓ should return default client config when no config is passed in a context
26
- ✓ should return custom client config when used properly in a context
27
-
28
-
29
- 7 passing (424ms)
30
-
31
- OK in 10114 ms
32
-
33
- CHECK COMPLETE in 21468 ms
package/src/banner.ts ADDED
@@ -0,0 +1,18 @@
1
+ //
2
+ // Copyright 2021 DXOS.org
3
+ //
4
+
5
+ let bannerPrinted = false;
6
+
7
+ export function printBanner () {
8
+ if (bannerPrinted) {
9
+ return;
10
+ }
11
+ bannerPrinted = true;
12
+
13
+ console.log('%cDXOS', `
14
+ text-align: center;
15
+ text-shadow: #ddd 4px -4px, #bbb 8px -8px, #999 12px -12px, #777 16px -16px;
16
+ font-size: 10em;padding:10px;
17
+ `);
18
+ }
@@ -9,6 +9,7 @@ import { Client, ClientOptions } from '@dxos/client';
9
9
  import { Config, ConfigObject } from '@dxos/config';
10
10
  import { MaybeFunction, MaybePromise, getAsyncValue } from '@dxos/util';
11
11
 
12
+ import { printBanner } from '../banner';
12
13
  import { ClientContext } from '../hooks';
13
14
 
14
15
  const log = debug('dxos:react-client');
@@ -64,6 +65,8 @@ export const ClientProvider = ({
64
65
 
65
66
  // Async helpers.
66
67
  useEffect(() => {
68
+ printBanner();
69
+
67
70
  if (!client) {
68
71
  const done = async (client: Client) => {
69
72
  log(`Created client: ${client}`);
@@ -18,8 +18,6 @@ export const useMembers = (party: PartyProxy | undefined) => {
18
18
  setMembers(result.value);
19
19
 
20
20
  return result.subscribe(() => {
21
- // TODO(wittjosiah): Result not triggering update when name loads.
22
- // https://github.com/dxos/protocols/issues/372
23
21
  const update = setInterval(() => {
24
22
  const newMembers = party.queryMembers().value;
25
23
  const isNameFilled = newMembers.every(m => m.displayName);
@@ -2,13 +2,12 @@
2
2
  // Copyright 2020 DXOS.org
3
3
  //
4
4
 
5
- import { useEffect, useMemo, useState } from 'react';
5
+ import { useEffect, useState } from 'react';
6
6
 
7
7
  import { PartyProxy } from '@dxos/client';
8
8
  import { PublicKey, PublicKeyLike } from '@dxos/crypto';
9
9
 
10
10
  import { useClient } from '../client';
11
- import { useResultSet } from '../util';
12
11
 
13
12
  /**
14
13
  * Get a specific Party.
@@ -16,6 +15,7 @@ import { useResultSet } from '../util';
16
15
  */
17
16
  export const useParty = (partyKey?: PublicKeyLike): PartyProxy | undefined => {
18
17
  const client = useClient();
18
+ // TODO(wittjosiah): Not responsive to party updates?
19
19
  return partyKey ? client.echo.getParty(PublicKey.from(partyKey)) : undefined;
20
20
  };
21
21
 
@@ -44,10 +44,3 @@ export const useParties = () => {
44
44
 
45
45
  return parties;
46
46
  };
47
-
48
- /**
49
- * Get all known members of a Party.
50
- */
51
- export const usePartyMembers = (party: PartyProxy) => {
52
- return useResultSet(useMemo(() => party.queryMembers(), [party.key.toHex()]));
53
- };