// @flow

import React from 'react';
import LoadingIndicator from 'app/components/LoadingIndicator';
import { get } from 'lodash';
import type { Props } from 'app/components/LoadingIndicator';

/**
 * A higher order component that wraps the given component in
 * LoadingIndicator while `props[loadingProp]` is being fetched.
 */
export default function loadingIndicator(
  loadingProps: string | string[],
  options: ?Props
) {
    // $FlowFixMe React.Node in >= 0.53

  return (Component: React.Class<*, *, *>) => {
    const Composed = (props: Object) => {
      let loading = true;
      if (Array.isArray(loadingProps)) {
        loading =
          loadingProps.filter(loadingProp => !get(props, loadingProps)).length >
          0;
      } else {
        loading = !get(props, loadingProps);
      }

      return (
        <LoadingIndicator {...options} loading={loading}>
          <Component {...props} />
        </LoadingIndicator>
      );
    };

    const name = Component.displayName || Component.name || 'Component';
    Composed.displayName = `Loading${name}`;
    return Composed;
  };
}

@@ -421,18 +421,16 @@
 ops%0A) %7B%0A
-  
   // $Fl
@@ -459,17 +459,16 @@
 %3E= 0.53%0A
-%0A
   return

Remove space