parent
c73f4a9730
commit
2b8202af72
1 changed files with 6 additions and 2 deletions
|
@ -13,7 +13,7 @@ import {
|
||||||
TreeView,
|
TreeView,
|
||||||
TreeViewDataItem,
|
TreeViewDataItem,
|
||||||
} from "@patternfly/react-core";
|
} from "@patternfly/react-core";
|
||||||
import { useState } from "react";
|
import { useRef, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
|
@ -130,6 +130,8 @@ export const GroupTree = ({
|
||||||
const [search, setSearch] = useState("");
|
const [search, setSearch] = useState("");
|
||||||
const [max, setMax] = useState(20);
|
const [max, setMax] = useState(20);
|
||||||
const [first, setFirst] = useState(0);
|
const [first, setFirst] = useState(0);
|
||||||
|
const prefFirst = useRef(0);
|
||||||
|
const prefMax = useRef(20);
|
||||||
const [count, setCount] = useState(0);
|
const [count, setCount] = useState(0);
|
||||||
const [exact, setExact] = useState(false);
|
const [exact, setExact] = useState(false);
|
||||||
const [activeItem, setActiveItem] = useState<TreeViewDataItem>();
|
const [activeItem, setActiveItem] = useState<TreeViewDataItem>();
|
||||||
|
@ -220,7 +222,7 @@ export const GroupTree = ({
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
setGroups(groups);
|
setGroups(groups);
|
||||||
if (search) {
|
if (search || prefFirst.current !== first || prefMax.current !== max) {
|
||||||
setData(groups.map((g) => mapGroup(g, refresh)));
|
setData(groups.map((g) => mapGroup(g, refresh)));
|
||||||
} else {
|
} else {
|
||||||
setData(
|
setData(
|
||||||
|
@ -232,6 +234,8 @@ export const GroupTree = ({
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
setCount(count);
|
setCount(count);
|
||||||
|
prefFirst.current = first;
|
||||||
|
prefMax.current = max;
|
||||||
},
|
},
|
||||||
[key, first, firstSub, max, search, exact, activeItem],
|
[key, first, firstSub, max, search, exact, activeItem],
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue