From 86de5c406f7d5667a7c8f3d9af6445c0a68133b4 Mon Sep 17 00:00:00 2001 From: Megha-Dev-19 <100185149+Megha-Dev-19@users.noreply.github.com> Date: Thu, 16 May 2024 00:48:52 +0530 Subject: [PATCH 1/4] added console logs --- .../widget/components/modals/projects/PotlockImport.jsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/builddao/widget/components/modals/projects/PotlockImport.jsx b/apps/builddao/widget/components/modals/projects/PotlockImport.jsx index 1d4dc964..35c68868 100644 --- a/apps/builddao/widget/components/modals/projects/PotlockImport.jsx +++ b/apps/builddao/widget/components/modals/projects/PotlockImport.jsx @@ -166,6 +166,8 @@ if (showCreateModalProjectId) { ); } +console.log({ filteredProjects, allRegistrations, projects, approvedProjects }); + return ( Date: Thu, 16 May 2024 00:51:12 +0530 Subject: [PATCH 2/4] update package.json --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index a6cd85d5..52708c4f 100644 --- a/package.json +++ b/package.json @@ -72,6 +72,7 @@ "serve": "webpack serve", "webpack": "webpack", "dev": "yarn bw ws dev", + "dev:mainnet": "yarn bw ws dev -n mainnet", "dev:testnet": "yarn bw ws dev -n testnet", "dev:gateway": "yarn run serve -- --env mode=development", "prod": "yarn webpack -- --env mode=production", From 90ecd6e1445dcd16b2d53c1896b0388f95a46fe6 Mon Sep 17 00:00:00 2001 From: Megha-Dev-19 <100185149+Megha-Dev-19@users.noreply.github.com> Date: Thu, 16 May 2024 01:07:01 +0530 Subject: [PATCH 3/4] added check for approved projects --- .../widget/components/modals/projects/PotlockImport.jsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/builddao/widget/components/modals/projects/PotlockImport.jsx b/apps/builddao/widget/components/modals/projects/PotlockImport.jsx index 35c68868..3548b85c 100644 --- a/apps/builddao/widget/components/modals/projects/PotlockImport.jsx +++ b/apps/builddao/widget/components/modals/projects/PotlockImport.jsx @@ -42,6 +42,10 @@ const [projects, approvedProjects] = useMemo(() => { return [allRegistrations, approvedProjects]; }, allRegistrations); +if (!approvedProjects) { + return <>; +} + const [filteredProjects, setFilteredProjects] = useState(approvedProjects); const searchByWords = (projects, searchTerm) => { From c846ffae447f9d205c38c10d9d4d9176e4829253 Mon Sep 17 00:00:00 2001 From: Megha-Dev-19 <100185149+Megha-Dev-19@users.noreply.github.com> Date: Thu, 16 May 2024 01:16:51 +0530 Subject: [PATCH 4/4] fix empty filtered projects --- .../components/modals/projects/PotlockImport.jsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/builddao/widget/components/modals/projects/PotlockImport.jsx b/apps/builddao/widget/components/modals/projects/PotlockImport.jsx index 3548b85c..03c59611 100644 --- a/apps/builddao/widget/components/modals/projects/PotlockImport.jsx +++ b/apps/builddao/widget/components/modals/projects/PotlockImport.jsx @@ -42,11 +42,13 @@ const [projects, approvedProjects] = useMemo(() => { return [allRegistrations, approvedProjects]; }, allRegistrations); -if (!approvedProjects) { - return <>; -} +const [filteredProjects, setFilteredProjects] = useState([]); -const [filteredProjects, setFilteredProjects] = useState(approvedProjects); +useEffect(() => { + if (!filteredProjects.length) { + setFilteredProjects(approvedProjects); + } +}, [approvedProjects]); const searchByWords = (projects, searchTerm) => { searchTerm = searchTerm.toLowerCase().trim();