@dxos/react-client 2.27.5-dev.746fe102 → 2.27.5-dev.a3555d64
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/.rush/temp/package-deps_build.json +4 -4
- package/.rush/temp/package-deps_build:test.json +4 -4
- package/.rush/temp/package-deps_prerelease.json +4 -4
- package/.rush/temp/shrinkwrap-deps.json +10 -9
- package/dist/src/hooks/echo-selections/search.d.ts +1 -0
- package/dist/src/hooks/echo-selections/search.d.ts.map +1 -1
- package/dist/src/hooks/echo-selections/search.js +3 -2
- package/dist/src/hooks/echo-selections/search.js.map +1 -1
- package/dist/src/hooks/echo-selections/useSelection.d.ts +1 -1
- package/dist/src/hooks/echo-selections/useSelection.d.ts.map +1 -1
- package/dist/src/hooks/echo-selections/useSelection.js +3 -2
- package/dist/src/hooks/echo-selections/useSelection.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/out/index.js +7 -3
- package/package.json +12 -12
- package/src/hooks/echo-selections/search.ts +2 -1
- package/src/hooks/echo-selections/useSelection.ts +4 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-client",
|
|
3
|
-
"version": "2.27.5-dev.
|
|
3
|
+
"version": "2.27.5-dev.a3555d64",
|
|
4
4
|
"description": "React client API",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "AGPL-3.0",
|
|
@@ -8,24 +8,24 @@
|
|
|
8
8
|
"main": "dist/src/index.js",
|
|
9
9
|
"types": "dist/src/index.d.ts",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@dxos/async": "2.27.5-dev.
|
|
12
|
-
"@dxos/bot-factory-client": "2.27.5-dev.
|
|
13
|
-
"@dxos/client": "2.27.5-dev.
|
|
14
|
-
"@dxos/config": "2.27.5-dev.
|
|
15
|
-
"@dxos/credentials": "2.27.5-dev.
|
|
16
|
-
"@dxos/crypto": "2.27.5-dev.
|
|
17
|
-
"@dxos/debug": "2.27.5-dev.
|
|
18
|
-
"@dxos/echo-db": "2.27.5-dev.
|
|
19
|
-
"@dxos/util": "2.27.5-dev.
|
|
11
|
+
"@dxos/async": "2.27.5-dev.a3555d64",
|
|
12
|
+
"@dxos/bot-factory-client": "2.27.5-dev.a3555d64",
|
|
13
|
+
"@dxos/client": "2.27.5-dev.a3555d64",
|
|
14
|
+
"@dxos/config": "2.27.5-dev.a3555d64",
|
|
15
|
+
"@dxos/credentials": "2.27.5-dev.a3555d64",
|
|
16
|
+
"@dxos/crypto": "2.27.5-dev.a3555d64",
|
|
17
|
+
"@dxos/debug": "2.27.5-dev.a3555d64",
|
|
18
|
+
"@dxos/echo-db": "2.27.5-dev.a3555d64",
|
|
19
|
+
"@dxos/util": "2.27.5-dev.a3555d64",
|
|
20
20
|
"assert": "^2.0.0",
|
|
21
21
|
"debug": "^4.3.3",
|
|
22
22
|
"react-display-name": "^0.2.5",
|
|
23
23
|
"use-subscription": "^1.4.1"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@dxos/esbuild-plugins": "2.27.5-dev.
|
|
26
|
+
"@dxos/esbuild-plugins": "2.27.5-dev.a3555d64",
|
|
27
27
|
"@dxos/toolchain-node-library": "2.27.4",
|
|
28
|
-
"@mui/material": "^5.
|
|
28
|
+
"@mui/material": "^5.4.2",
|
|
29
29
|
"@testing-library/react": "^11.0.4",
|
|
30
30
|
"@testing-library/react-hooks": "5.1.2",
|
|
31
31
|
"@types/debug": "^4.1.7",
|
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
import { Party } from '@dxos/client';
|
|
6
6
|
|
|
7
|
-
import { useSelection } from '
|
|
7
|
+
import { useSelection } from './useSelection';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* A Selector used for finding items based on a search pattern.
|
|
11
|
+
* @param party
|
|
11
12
|
* @param search Searched value.
|
|
12
13
|
*/
|
|
13
14
|
// TODO(burdon): Create index.
|
|
@@ -18,10 +18,10 @@ import { Falsy } from '@dxos/util';
|
|
|
18
18
|
* @param selection Selection from which to query data. Can be falsy - in that case the hook will return undefined.
|
|
19
19
|
* @param deps Array of values that trigger the selector when changed.
|
|
20
20
|
*/
|
|
21
|
-
export
|
|
21
|
+
export const useSelection = <T extends Entity<any>> (
|
|
22
22
|
selection: Selection<T> | SelectionResult<T> | Falsy,
|
|
23
23
|
deps: readonly any[] = []
|
|
24
|
-
): T[] | undefined {
|
|
24
|
+
): T[] | undefined => {
|
|
25
25
|
const [result, setResult] = useState(() => coerseSelection(selection));
|
|
26
26
|
const [data, setData] = useState(() => result ? result.result : undefined);
|
|
27
27
|
|
|
@@ -43,8 +43,9 @@ export function useSelection<T extends Entity<any>> (
|
|
|
43
43
|
}, [result]);
|
|
44
44
|
|
|
45
45
|
return data;
|
|
46
|
-
}
|
|
46
|
+
};
|
|
47
47
|
|
|
48
|
+
// TODO(burdon): Typo (coerce).
|
|
48
49
|
const coerseSelection = <T extends Entity>(arg: Selection<T> | SelectionResult<T> | Falsy): SelectionResult<T> | undefined =>
|
|
49
50
|
!arg ? undefined
|
|
50
51
|
: arg instanceof Selection ? arg.query()
|