ktmud commented on a change in pull request #9333:  build: use manifest hooks 
for dev server proxy
URL: 
https://github.com/apache/incubator-superset/pull/9333#discussion_r396947315
 
 

 ##########
 File path: superset-frontend/src/chart/ChartRenderer.jsx
 ##########
 @@ -58,6 +59,46 @@ const defaultProps = {
   triggerRender: false,
 };
 
+const isDevMode = process.env.WEBPACK_MODE === 'development';
+if (isDevMode) {
+  setConfig({ logLevel: 'debug', trackTailUpdates: false });
+}
+
+/**
+ * Compare two objects shallowly, but ignore some keys
+ */
+function deepEqual(obj1, obj2, maxDepth = Infinity, depth = 0) {
+  if (
+    // don't go too deep
+    depth > maxDepth ||
+    // nulls
+    obj1 === null ||
+    obj2 === null ||
+    // primatives
+    typeof obj1 !== 'object' ||
+    typeof obj2 !== 'object'
+  ) {
+    return obj1 === obj2;
+  }
+
+  // arrays
+  if (Array.isArray(obj1) && Array.isArray(obj2)) {
+    return (
+      obj1.length === obj2.length &&
+      obj1.every((val, i) => deepEqual(val, obj2[i], maxDepth, depth + 1))
+    );
+  }
+
+  // objects
+  for (const [key, val] of Object.entries(obj1)) {
+    if (!deepEqual(obj2[key], val, maxDepth, depth + 1)) {
+      // console.log('>> Diff "%s":', key, depth, val, obj2[key]);
+      return false;
+    }
+  }
+  return true;
+}
+
 
 Review comment:
   I wrote my own depth-limited `deepEqual` function. Would be happy to use any 
existing library or util function if it exists.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to