Skip to content

Commit 8577254

Browse files
committed
Optimise getting entity metadata in explorer
1 parent ef20fdb commit 8577254

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/app/src/explorer/EntityList.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { assertGroup } from '@h5web/shared/guards';
22
import { buildEntityPath } from '@h5web/shared/hdf5-utils';
3+
import { useDeferredValue } from 'react';
34

45
import { useEntity } from '../hooks';
56
import EntityItem from './EntityItem';
@@ -15,7 +16,8 @@ interface Props {
1516
function EntityList(props: Props) {
1617
const { level, parentPath, selectedPath, onSelect } = props;
1718

18-
const group = useEntity(parentPath);
19+
const parentPathDef = useDeferredValue(parentPath);
20+
const group = useEntity(parentPathDef);
1921
assertGroup(group);
2022

2123
if (group.children.length === 0) {
@@ -30,7 +32,7 @@ function EntityList(props: Props) {
3032
return (
3133
<EntityItem
3234
key={name}
33-
path={buildEntityPath(parentPath, name)}
35+
path={buildEntityPath(parentPathDef, name)}
3436
entity={entity}
3537
level={level}
3638
selectedPath={selectedPath}

0 commit comments

Comments
 (0)