diff --git a/dashboard/src/scenes/structure/list.js b/dashboard/src/scenes/structure/list.js
index b55039b16..a5f212da9 100644
--- a/dashboard/src/scenes/structure/list.js
+++ b/dashboard/src/scenes/structure/list.js
@@ -1,4 +1,4 @@
-import React, { useEffect, useState } from 'react';
+import React, { useEffect, useMemo, useState } from 'react';
import { SmallHeader } from '../../components/header';
import Loading from '../../components/loading';
import Table from '../../components/table';
@@ -13,6 +13,7 @@ import SelectCustom from '../../components/SelectCustom';
import { useRecoilValue } from 'recoil';
import { userState } from '../../recoil/auth';
import { flattenedStructuresCategoriesSelector } from '../../recoil/structures';
+import { filterBySearch } from '../search/utils';
const List = () => {
const [structures, setStructures] = useState([]);
@@ -22,10 +23,14 @@ const List = () => {
const [currentStructure, setCurrentStructure] = useState(null);
const [currentStructureOpen, setCurrentStructureOpen] = useState(false);
+ const filteredStructures = useMemo(() => {
+ return filterBySearch(search, structures);
+ }, [search, structures]);
+
useTitle('Structures');
const getStructures = async () => {
- const response = await API.get({ path: '/structure', query: { search } });
+ const response = await API.get({ path: '/structure' });
if (response.ok) {
setStructures(response.data);
}
@@ -34,14 +39,13 @@ const List = () => {
useEffect(() => {
getStructures();
- // eslint-disable-next-line react-hooks/exhaustive-deps
- }, [search]);
+ }, []);
if (isLoading) return