mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-11 21:27:05 +00:00
refactor: useMemo instead for better performance
This commit is contained in:
parent
87436adc73
commit
1629bc0aae
2 changed files with 5 additions and 5 deletions
|
|
@ -22,10 +22,9 @@ const StreamsList = ({ className, video, ...props }) => {
|
|||
const backButtonOnClick = React.useCallback(() => {
|
||||
window.history.back();
|
||||
}, []);
|
||||
const countLoadingStreams = () => {
|
||||
const countLoadingAddons = React.useMemo(() => {
|
||||
return props.streams.filter((stream) => stream.content.type === 'Loading').length;
|
||||
};
|
||||
const loadingAddonsCount = countLoadingStreams();
|
||||
}, [props.streams]);
|
||||
const streamsByAddon = React.useMemo(() => {
|
||||
return props.streams
|
||||
.filter((streams) => streams.content.type === 'Ready')
|
||||
|
|
@ -100,10 +99,10 @@ const StreamsList = ({ className, video, ...props }) => {
|
|||
:
|
||||
<React.Fragment>
|
||||
{
|
||||
loadingAddonsCount > 0 ?
|
||||
countLoadingAddons > 0 ?
|
||||
<div className={styles['addons-loading-container']}>
|
||||
<div className={styles['addons-loading']}>
|
||||
{loadingAddonsCount} {t('MOBILE_ADDONS_LOADING')}
|
||||
{countLoadingAddons} {t('MOBILE_ADDONS_LOADING')}
|
||||
</div>
|
||||
<span className={styles['addons-loading-bar']}></span>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@
|
|||
background-color: var(--primary-accent-color);
|
||||
}
|
||||
}
|
||||
|
||||
.select-choices-wrapper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
|
|
|||
Loading…
Reference in a new issue