function normalizeQuery(query, tableMetadata) {
  if (!query) {
    return query;
  }
  if (query.query && tableMetadata) {
    query = updateIn(query, ["query", "fields"], fields => {
      fields = fields
        ? // if the query has fields, copy them before sorting
          [...fields]
        : // if the fields aren't set, we get them from the table metadata
          tableMetadata.fields.map(({ id }) => ["field", id, null]);
      return fields.sort((a, b) =>
        JSON.stringify(b).localeCompare(JSON.stringify(a)),
      );
    });
  }
  if (query.native && query.native["template-tags"] == null) {
    query = assocIn(query, ["native", "template-tags"], {});
  }
  return query;
}
// standardizes the query before comparision in `getIsResultDirty`.
standardizes the query before comparision in `getIsResultDirty`.
standardizes the query before comparision in ` getIsResultDirty ` .
function normalizeQuery(query, tableMetadata) {
  if (!query) {
    return query;
  }
  if (query.query && tableMetadata) {
    query = updateIn(query, ["query", "fields"], fields => {
      fields = fields
        ? 
          [...fields]
        : 
          tableMetadata.fields.map(({ id }) => ["field", id, null]);
      return fields.sort((a, b) =>
        JSON.stringify(b).localeCompare(JSON.stringify(a)),
      );
    });
  }
  if (query.native && query.native["template-tags"] == null) {
    query = assocIn(query, ["native", "template-tags"], {});
  }
  return query;
}
function normalizeQuery ( query , tableMetadata ) { if ( ! query ) { return query ; } if ( query . query && tableMetadata ) { query = updateIn ( query , [ "query" , "fields" ] , fields => { fields = fields ? [ ... fields ] : tableMetadata . fields . map ( ( { id } ) => [ "field" , id , null ] ) ; return fields . sort ( ( a , b ) => JSON . stringify ( b ) . localeCompare ( JSON . stringify ( a ) ) , ) ; } ) ; } if ( query . native && query . native [ "template-tags" ] == null ) { query = assocIn ( query , [ "native" , "template-tags" ] , { } ) ; } return query ; }
standardizes the query before comparision in `getIsResultDirty`.
standardizes the query before comparision in ` getIsResultDirty ` .
// if the query has fields, copy them before sorting // if the fields aren't set, we get them from the table metadata