From cc2a06e7af3789fbc46b8c2d67cb670864b40db8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hubert=20Soko=C5=82owski?= Date: Fri, 16 Jun 2023 14:00:12 +0200 Subject: [PATCH] fixed test tree (now is showing again) --- src/components/Tree.jsx | 60 ++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/src/components/Tree.jsx b/src/components/Tree.jsx index 91d21ad..babf1b9 100644 --- a/src/components/Tree.jsx +++ b/src/components/Tree.jsx @@ -51,22 +51,22 @@ const Tree = ({ options, headers }) => { const [showTestTree, setShowTestTree] = useState(false); const { isLoading, setIsLoading } = useLoadingContext(); - const updateTestTree = useCallback( - newRoot => { - console.log(options.categoryAttr); - let tmpRoot = JSON.parse(JSON.stringify(newRoot)); - if (testSet == null) { - rebuildTestTree(tmpRoot, options.trainingSet, options.categoryAttr); - console.log(tmpRoot); - setSecondRoot(tmpRoot); - } else { - rebuildTestTree(tmpRoot, testSet, options.categoryAttr); - //console.log(tmpRoot); - setSecondRoot(tmpRoot); - } - }, - [options.categoryAttr, options.trainingSet, testSet] - ); + // const updateTestTree = useCallback( + // newRoot => { + // console.log(options.categoryAttr); + // let tmpRoot = JSON.parse(JSON.stringify(newRoot)); + // if (testSet == null) { + // rebuildTestTree(tmpRoot, options.trainingSet, options.categoryAttr); + // console.log(tmpRoot); + // setSecondRoot(tmpRoot); + // } else { + // rebuildTestTree(tmpRoot, testSet, options.categoryAttr); + // //console.log(tmpRoot); + // setSecondRoot(tmpRoot); + // } + // }, + // [options.categoryAttr, options.trainingSet, testSet] + // ); useEffect(() => { setRoot(null); @@ -92,7 +92,7 @@ const Tree = ({ options, headers }) => { } terminated = true; }; - }, [options, setIsLoading, updateTestTree]); + }, [options, setIsLoading]); useEffect(() => { if (root !== null) { @@ -109,19 +109,19 @@ const Tree = ({ options, headers }) => { setTestSet(data); } - // function updateTestTree(newRoot) { - // console.log(options.categoryAttr); - // let tmpRoot = JSON.parse(JSON.stringify(newRoot)); - // if (testSet == null) { - // rebuildTestTree(tmpRoot, options.trainingSet, options.categoryAttr); - // console.log(tmpRoot); - // setSecondRoot(tmpRoot); - // } else { - // rebuildTestTree(tmpRoot, testSet, options.categoryAttr); - // //console.log(tmpRoot); - // setSecondRoot(tmpRoot); - // } - // } + function updateTestTree(newRoot) { + console.log(options.categoryAttr); + let tmpRoot = JSON.parse(JSON.stringify(newRoot)); + if (testSet == null) { + rebuildTestTree(tmpRoot, options.trainingSet, options.categoryAttr); + console.log(tmpRoot); + setSecondRoot(tmpRoot); + } else { + rebuildTestTree(tmpRoot, testSet, options.categoryAttr); + //console.log(tmpRoot); + setSecondRoot(tmpRoot); + } + } function handleShowTestTree(e) { //console.log(e);