You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/04/07 16:35:18 UTC

[GitHub] [airflow] ashb commented on a diff in pull request #22787: Set Grid view data as camelCase in webserver

ashb commented on code in PR #22787:
URL: https://github.com/apache/airflow/pull/22787#discussion_r845353739


##########
airflow/www/static/js/tree/treeDataUtils.js:
##########
@@ -17,5 +17,13 @@
  * under the License.
  */
 
-// eslint-disable-next-line import/prefer-default-export
 export const areActiveRuns = (runs = []) => runs.filter((run) => ['queued', 'running', 'scheduled'].includes(run.state)).length > 0;
+
+export const parseJSON = (data, emptyData = {}) => {
+  if (!data) return emptyData;
+  try {
+    return JSON.parse(data);
+  } catch (e) {
+    return emptyData;

Review Comment:
   Returning empty on invalid data seems un-ideal.



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org