mirror of
https://github.com/Unleash/unleash.git
synced 2025-07-31 13:47:02 +02:00
fix: use Rect.memo to increase performance
This commit is contained in:
parent
5cb2036bba
commit
8df8ee8bcd
@ -1,4 +1,4 @@
|
|||||||
import React from 'react';
|
import React, { memo } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import { Switch, ListItem, ListItemAction, Icon } from 'react-mdl';
|
import { Switch, ListItem, ListItemAction, Icon } from 'react-mdl';
|
||||||
@ -51,7 +51,7 @@ const Feature = ({
|
|||||||
<Link to={featureUrl} className={[commonStyles.listLink, commonStyles.truncate].join(' ')}>
|
<Link to={featureUrl} className={[commonStyles.listLink, commonStyles.truncate].join(' ')}>
|
||||||
<span className={commonStyles.toggleName}>{name} </span>
|
<span className={commonStyles.toggleName}>{name} </span>
|
||||||
<small className="mdl-color-text--blue-grey-300">
|
<small className="mdl-color-text--blue-grey-300">
|
||||||
<TimeAgo date={createdAt} />
|
<TimeAgo date={createdAt} live={false} />
|
||||||
</small>
|
</small>
|
||||||
<span className={['mdl-list__item-sub-title', commonStyles.truncate].join(' ')}>{description}</span>
|
<span className={['mdl-list__item-sub-title', commonStyles.truncate].join(' ')}>{description}</span>
|
||||||
</Link>
|
</Link>
|
||||||
@ -81,4 +81,4 @@ Feature.propTypes = {
|
|||||||
hasPermission: PropTypes.func.isRequired,
|
hasPermission: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Feature;
|
export default memo(Feature);
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import React from 'react';
|
import React, { memo } from 'react';
|
||||||
import { Chip } from 'react-mdl';
|
import { Chip } from 'react-mdl';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import styles from './feature.scss';
|
import styles from './feature.scss';
|
||||||
|
|
||||||
export default function StatusComponent({ type, types, onClick }) {
|
function StatusComponent({ type, types, onClick }) {
|
||||||
const typeObject = types.find(o => o.id === type) || { id: type, name: type };
|
const typeObject = types.find(o => o.id === type) || { id: type, name: type };
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -13,6 +13,8 @@ export default function StatusComponent({ type, types, onClick }) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default memo(StatusComponent);
|
||||||
|
|
||||||
StatusComponent.propTypes = {
|
StatusComponent.propTypes = {
|
||||||
type: PropTypes.string.isRequired,
|
type: PropTypes.string.isRequired,
|
||||||
types: PropTypes.array,
|
types: PropTypes.array,
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import React from 'react';
|
import React, { memo } from 'react';
|
||||||
import { Chip } from 'react-mdl';
|
import { Chip } from 'react-mdl';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
export default function StatusComponent({ stale, style, showActive = true }) {
|
function StatusComponent({ stale, style, showActive = true }) {
|
||||||
if (!stale && !showActive) {
|
if (!stale && !showActive) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -21,6 +21,8 @@ export default function StatusComponent({ stale, style, showActive = true }) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default memo(StatusComponent);
|
||||||
|
|
||||||
StatusComponent.propTypes = {
|
StatusComponent.propTypes = {
|
||||||
stale: PropTypes.bool.isRequired,
|
stale: PropTypes.bool.isRequired,
|
||||||
style: PropTypes.object,
|
style: PropTypes.object,
|
||||||
|
Loading…
Reference in New Issue
Block a user