Repository: hasura/graphql-engine
File: console/src/components/Services/Data/TableModify/ColumnEditorList.js (JavaScript)

Code before:
      isUnique: isColumnUnique(tableSchema, colName),
      // uniqueConstraint: columnUniqueConstraints[colName],
      default: col.column_default || '',
      comment: col.comment || '',
      customFieldName: customColumnNames[colName] || '',
      isOnlyPrimaryKey: columnPKConstraints[colName] && pkLength === 1,
    };

    const onSubmit = toggleEditor => {
      dispatch(saveColumnChangesSql(colName, col, toggleEditor));
    };

    const onDelete = () => {
      let confirmMessage = `This will permanently delete the column "${colName}" from this table`;
      if (columnProperties.pkConstraint) {
        confirmMessage = DELETE_PK_WARNING;
      }

      const isOk = getConfirmation(confirmMessage, true, colName);
      if (isOk) {
        const pk = [];
        let flag = true;
        tableSchema.primary_key.columns.forEach(pkCol => {
          const currentPKCol = pkCol;
          tableSchema.columns.forEach((nonPKCol, colIndex) => {
            if (!nonPKCol.column_name.localeCompare(colName)) {
              flag = false;
            } else {
              if (flag && !currentPKCol.localeCompare(nonPKCol.column_name)) {
                pk.push(colIndex);
              } else if (!currentPKCol.localeCompare(nonPKCol.column_name)) {
                pk.push(colIndex - 1);
              }
            }
          });
          flag = true;
        });

        const pks = [...pk.sort(), ''];
        dispatch(setPrimaryKeys(pks));
        dispatch(deleteColumnSql(col, tableSchema));
      }
    };
    const gqlCompatibilityWarning = () => {
      return (
        <GqlCompatibilityWarning
          identifier={colName}
          className={styles.add_mar_left_small}
        />
      );
    };

Review comment (suggestion):
Doesn't seem necessary to use `localeCompare`
We can just use `nonPKCol.column_name !== colName`
Strings can be compared easily with the equality operators (`===`, `!==`) 😄 

Code after:
      // uniqueConstraint: columnUniqueConstraints[colName],
      default: col.column_default || '',
      comment: col.comment || '',
      customFieldName: customColumnNames[colName] || '',
      isOnlyPrimaryKey: columnPKConstraints[colName] && pkLength === 1,
    };

    const onSubmit = toggleEditor => {
      dispatch(saveColumnChangesSql(colName, col, toggleEditor));
    };

    const onDelete = () => {
      let confirmMessage = `This will permanently delete the column "${colName}" from this table`;
      if (columnProperties.pkConstraint) {
        confirmMessage = DELETE_PK_WARNING;
      }

      const isOk = getConfirmation(confirmMessage, true, colName);
      if (isOk) {
        dispatch(deleteColumnSql(col, tableSchema));
      }
    };
    const gqlCompatibilityWarning = () => {
      return (
        <GqlCompatibilityWarning
          identifier={colName}
          className={styles.add_mar_left_small}
        />
      );
    };

    const keyProperties = () => {
      const propertiesDisplay = [];

      const propertiesList = [];
      propertiesList.push(columnProperties.display_type_name);

      if (columnProperties.pkConstraint) {
        propertiesList.push('primary key');
      }

      if (columnProperties.isUnique || columnProperties.isOnlyPrimaryKey) {
        propertiesList.push('unique');
      }

      if (columnProperties.isIdentity) {
        propertiesList.push('identity');
      }

      if (columnProperties.isNullable) {
        propertiesList.push('nullable');