import * as React from 'react'; import isEqual from 'lodash/isEqual'; import ProjectsStore from 'app/stores/projectsStore'; import {Project} from 'app/types'; import getDisplayName from 'app/utils/getDisplayName'; type Props = { projects?: Project[]; specificProjectSlugs?: string[]; }; type InjectedProjectsProps = { loadingProjects: boolean; } & Props; type State = { projects: Project[]; loading: boolean; }; /** * Higher order component that takes specificProjectSlugs and provides list of that projects from ProjectsStore */ function withProjectsSpecified
( WrappedComponent: React.ComponentType
) { class WithProjectsSpecified extends React.Component< Props & Omit
,
State
> {
static displayName = `withProjectsSpecified(${getDisplayName(WrappedComponent)})`;
state = ProjectsStore.getState(this.props.specificProjectSlugs);
static getDerivedStateFromProps(nextProps: Readonly