query fixes

This commit is contained in:
Jan Prochazka
2020-04-12 10:55:41 +02:00
parent 6da41bcf4a
commit 241d8ea647
7 changed files with 38 additions and 10 deletions

View File

@@ -61,13 +61,17 @@ export function TabPage({ key, label, children }) {
return children;
}
export function TabControl({ children }) {
export function TabControl({ children, activePageIndex = undefined }) {
const [value, setValue] = React.useState(0);
// const [mountedTabs, setMountedTabs] = React.useState({});
const childrenArray = (_.isArray(children) ? _.flatten(children) : [children]).filter((x) => x);
React.useEffect(() => {
if (activePageIndex != null) setValue(activePageIndex);
}, [activePageIndex]);
// // cleanup closed tabs
// if (_.difference(_.keys(mountedTabs), _.map(childrenArray, 'props.key')).length > 0) {
// setMountedTabs(_.pickBy(mountedTabs, (v, k) => childrenArray.find((x) => x.props.key == k)));