mirror of
https://github.com/Unleash/unleash.git
synced 2025-07-26 13:48:33 +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 { Link } from 'react-router-dom';
|
||||
import { Switch, ListItem, ListItemAction, Icon } from 'react-mdl';
|
||||
@ -51,7 +51,7 @@ const Feature = ({
|
||||
<Link to={featureUrl} className={[commonStyles.listLink, commonStyles.truncate].join(' ')}>
|
||||
<span className={commonStyles.toggleName}>{name} </span>
|
||||
<small className="mdl-color-text--blue-grey-300">
|
||||
<TimeAgo date={createdAt} />
|
||||
<TimeAgo date={createdAt} live={false} />
|
||||
</small>
|
||||
<span className={['mdl-list__item-sub-title', commonStyles.truncate].join(' ')}>{description}</span>
|
||||
</Link>
|
||||
@ -81,4 +81,4 @@ Feature.propTypes = {
|
||||
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 PropTypes from 'prop-types';
|
||||
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 };
|
||||
|
||||
return (
|
||||
@ -13,6 +13,8 @@ export default function StatusComponent({ type, types, onClick }) {
|
||||
);
|
||||
}
|
||||
|
||||
export default memo(StatusComponent);
|
||||
|
||||
StatusComponent.propTypes = {
|
||||
type: PropTypes.string.isRequired,
|
||||
types: PropTypes.array,
|
||||
|
@ -1,8 +1,8 @@
|
||||
import React from 'react';
|
||||
import React, { memo } from 'react';
|
||||
import { Chip } from 'react-mdl';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
export default function StatusComponent({ stale, style, showActive = true }) {
|
||||
function StatusComponent({ stale, style, showActive = true }) {
|
||||
if (!stale && !showActive) {
|
||||
return null;
|
||||
}
|
||||
@ -21,6 +21,8 @@ export default function StatusComponent({ stale, style, showActive = true }) {
|
||||
);
|
||||
}
|
||||
|
||||
export default memo(StatusComponent);
|
||||
|
||||
StatusComponent.propTypes = {
|
||||
stale: PropTypes.bool.isRequired,
|
||||
style: PropTypes.object,
|
||||
|
Loading…
Reference in New Issue
Block a user