mirror of
https://github.com/element-hq/element-web
synced 2024-11-24 10:15:43 +03:00
Merge pull request #6876 from matrix-org/t3chguy/fix/space-hierarchy-filter
This commit is contained in:
commit
2c42946409
1 changed files with 10 additions and 11 deletions
|
@ -446,13 +446,13 @@ export const useSpaceSummary = (space: Room): {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const loadMore = useCallback(async (pageSize?: number) => {
|
const loadMore = useCallback(async (pageSize?: number) => {
|
||||||
if (!hierarchy.canLoadMore || hierarchy.noSupport) return;
|
if (loading || !hierarchy.canLoadMore || hierarchy.noSupport) return;
|
||||||
|
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
await hierarchy.load(pageSize);
|
await hierarchy.load(pageSize);
|
||||||
setRooms(hierarchy.rooms);
|
setRooms(hierarchy.rooms);
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}, [hierarchy]);
|
}, [loading, hierarchy]);
|
||||||
|
|
||||||
return { loading, rooms, hierarchy, loadMore };
|
return { loading, rooms, hierarchy, loadMore };
|
||||||
};
|
};
|
||||||
|
@ -648,8 +648,6 @@ const SpaceHierarchy = ({
|
||||||
return <RovingTabIndexProvider onKeyDown={onKeyDown} handleHomeEnd handleUpDown>
|
return <RovingTabIndexProvider onKeyDown={onKeyDown} handleHomeEnd handleUpDown>
|
||||||
{ ({ onKeyDownHandler }) => {
|
{ ({ onKeyDownHandler }) => {
|
||||||
let content: JSX.Element;
|
let content: JSX.Element;
|
||||||
let loader: JSX.Element;
|
|
||||||
|
|
||||||
if (loading && !rooms.length) {
|
if (loading && !rooms.length) {
|
||||||
content = <Spinner />;
|
content = <Spinner />;
|
||||||
} else {
|
} else {
|
||||||
|
@ -671,19 +669,20 @@ const SpaceHierarchy = ({
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</>;
|
</>;
|
||||||
|
} else if (!hierarchy.canLoadMore) {
|
||||||
if (hierarchy.canLoadMore) {
|
|
||||||
loader = <div ref={loaderRef}>
|
|
||||||
<Spinner />
|
|
||||||
</div>;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
results = <div className="mx_SpaceHierarchy_noResults">
|
results = <div className="mx_SpaceHierarchy_noResults">
|
||||||
<h3>{ _t("No results found") }</h3>
|
<h3>{ _t("No results found") }</h3>
|
||||||
<div>{ _t("You may want to try a different search or check for typos.") }</div>
|
<div>{ _t("You may want to try a different search or check for typos.") }</div>
|
||||||
</div>;
|
</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let loader: JSX.Element;
|
||||||
|
if (hierarchy.canLoadMore) {
|
||||||
|
loader = <div ref={loaderRef}>
|
||||||
|
<Spinner />
|
||||||
|
</div>;
|
||||||
|
}
|
||||||
|
|
||||||
content = <>
|
content = <>
|
||||||
<div className="mx_SpaceHierarchy_listHeader">
|
<div className="mx_SpaceHierarchy_listHeader">
|
||||||
<h4>{ query.trim() ? _t("Results") : _t("Rooms and spaces") }</h4>
|
<h4>{ query.trim() ? _t("Results") : _t("Rooms and spaces") }</h4>
|
||||||
|
|
Loading…
Reference in a new issue