diff --git a/packages/app-admin/src/context/CrudContext/functions/searchDataByKey.js b/packages/app-admin/src/context/CrudContext/functions/searchDataByKey.js index 2c22e88c301..417389b62d2 100644 --- a/packages/app-admin/src/context/CrudContext/functions/searchDataByKey.js +++ b/packages/app-admin/src/context/CrudContext/functions/searchDataByKey.js @@ -3,12 +3,15 @@ const searchDataByKey = (searchKey, object) => { return null; } + if (object[searchKey]) { + return object[searchKey]; + } + for (let key in object) { - if (key === searchKey) { - return object.data; + const value = searchDataByKey(searchKey, object[key]); + if (value) { + return value; } - - return searchDataByKey(searchKey, object[key]); } return null;