datajunction-ui 0.0.1-a82 → 0.0.1-a84

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": "datajunction-ui",
3
- "version": "0.0.1a82",
3
+ "version": "0.0.1a84",
4
4
  "description": "DataJunction Metrics Platform UI",
5
5
  "module": "src/index.tsx",
6
6
  "repository": {
@@ -17,42 +17,37 @@ export default function Search() {
17
17
  }
18
18
  return str.length > 100 ? str.substring(0, 90) + '...' : str;
19
19
  };
20
+
20
21
  useEffect(() => {
21
22
  const fetchNodes = async () => {
22
- const data = (await djClient.nodeDetails()) || [];
23
- const tags = (await djClient.listTags()) || [];
24
- const allEntities = data.concat(
25
- tags.map(tag => {
26
- tag.type = 'tag';
27
- return tag;
28
- }),
29
- );
30
- const fuse = new Fuse(allEntities || [], {
31
- keys: [
32
- 'name', // will be assigned a `weight` of 1
33
- {
34
- name: 'description',
35
- weight: 2,
36
- },
37
- {
38
- name: 'display_name',
39
- weight: 3,
40
- },
41
- {
42
- name: 'type',
43
- weight: 4,
44
- },
45
- {
46
- name: 'tag_type',
47
- weight: 5,
48
- },
49
- ],
50
- });
51
- setFuse(fuse);
23
+ try {
24
+ const [data, tags] = await Promise.all([
25
+ djClient.nodeDetails(),
26
+ djClient.listTags(),
27
+ ]);
28
+ const allEntities = data.concat(
29
+ (tags || []).map(tag => {
30
+ tag.type = 'tag';
31
+ return tag;
32
+ }),
33
+ );
34
+ const fuse = new Fuse(allEntities || [], {
35
+ keys: [
36
+ 'name', // will be assigned a `weight` of 1
37
+ { name: 'description', weight: 2 },
38
+ { name: 'display_name', weight: 3 },
39
+ { name: 'type', weight: 4 },
40
+ { name: 'tag_type', weight: 5 },
41
+ ],
42
+ });
43
+ setFuse(fuse);
44
+ } catch (error) {
45
+ console.error('Error fetching nodes or tags:', error);
46
+ }
52
47
  };
53
48
  fetchNodes();
54
49
  }, []);
55
-
50
+
56
51
  const handleChange = e => {
57
52
  setSearchValue(e.target.value);
58
53
  if (fuse) {