Ignore hashtag history if undefined

This commit is contained in:
Laura Hausmann 2023-10-14 14:59:59 +02:00
parent aa27eaece4
commit 1feffe4326
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -63,7 +63,7 @@ export const ImmutableHashtag = ({ hashtag }) => (
to={`/tags/${hashtag.get('name')}`} to={`/tags/${hashtag.get('name')}`}
people={hashtag.getIn(['history', 0, 'accounts']) * 1 + hashtag.getIn(['history', 1, 'accounts']) * 1} people={hashtag.getIn(['history', 0, 'accounts']) * 1 + hashtag.getIn(['history', 1, 'accounts']) * 1}
// @ts-expect-error // @ts-expect-error
history={hashtag.get('history').reverse().map((day) => day.get('uses')).toArray()} history={hashtag.get('history')?.reverse().map((day) => day.get('uses')).toArray()}
/> />
); );
@ -82,7 +82,7 @@ const Hashtag = ({ name, href, to, people, uses, history, className, description
{description ? ( {description ? (
<span>{description}</span> <span>{description}</span>
) : ( ) : (
typeof people !== 'undefined' ? <ShortNumber value={people} renderer={accountsCountRenderer} /> : <Skeleton width={100} /> !isNaN(people) && (typeof people !== 'undefined' ? <ShortNumber value={people} renderer={accountsCountRenderer} /> : <Skeleton width={100} />)
)} )}
</div> </div>
@ -92,7 +92,7 @@ const Hashtag = ({ name, href, to, people, uses, history, className, description
</div> </div>
)} )}
{withGraph && ( {withGraph && typeof history !== 'undefined' && (
<div className='trends__item__sparkline'> <div className='trends__item__sparkline'>
<SilentErrorBoundary> <SilentErrorBoundary>
<Sparklines width={50} height={28} data={history ? history : Array.from(Array(7)).map(() => 0)}> <Sparklines width={50} height={28} data={history ? history : Array.from(Array(7)).map(() => 0)}>