This is an automated email from the ASF dual-hosted git repository.

ciscozhou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/inlong.git


The following commit(s) were added to refs/heads/master by this push:
     new c00622458 [INLONG-6359][Dashboard] The utils method adds null data 
compatibility (#6360)
c00622458 is described below

commit c00622458692afa62aafdd41d90f98eaf34d8eae
Author: Daniel <lee...@apache.org>
AuthorDate: Tue Nov 1 23:07:53 2022 +0800

    [INLONG-6359][Dashboard] The utils method adds null data compatibility 
(#6360)
---
 inlong-dashboard/src/utils/index.ts | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/inlong-dashboard/src/utils/index.ts 
b/inlong-dashboard/src/utils/index.ts
index 6479b6fdc..59a94fa64 100644
--- a/inlong-dashboard/src/utils/index.ts
+++ b/inlong-dashboard/src/utils/index.ts
@@ -130,6 +130,7 @@ export function filterObj(obj: Record<string, any>, 
keyList: string[]) {
  * @param key Flag
  */
 export function pickObjectArray(keys = [], sourceArr = [], key = 'name') {
+  if (!sourceArr || !sourceArr.length) return sourceArr;
   const map = new Map(sourceArr.map(item => [item[key], item]));
   if (isDevelopEnv()) {
     // Increase the log in the development environment to facilitate debugging
@@ -183,6 +184,7 @@ export function excludeObject<T>(keys = [], sourceObj: 
Record<string, unknown>):
  * @param key Flag
  */
 export function excludeObjectArray(keys = [], sourceArr = [], key = 'name') {
+  if (!sourceArr || !sourceArr.length) return sourceArr;
   const set = new Set(keys);
   return sourceArr.filter(item => !set.has(item[key]));
 }

Reply via email to