1
0
Fork 0

Fix history key might be undefined in hashtag object

And some other fixes
This commit is contained in:
Lim Chee Aun 2023-12-03 13:09:05 +08:00
parent 2ad72a667d
commit 810596b7cf

View file

@ -253,21 +253,21 @@ function Search(props) {
<ul class="link-list hashtag-list">
{hashtagResults.map((hashtag) => {
const { name, history } = hashtag;
const total = history.reduce(
const total = history?.reduce?.(
(acc, cur) => acc + +cur.uses,
0,
);
return (
<li key={hashtag.name}>
<li key={`${name}-${total}`}>
<Link
to={
instance
? `/${instance}/t/${hashtag.name}`
: `/t/${hashtag.name}`
? `/${instance}/t/${name}`
: `/t/${name}`
}
>
<Icon icon="hashtag" />
<span>{hashtag.name}</span>
<span>{name}</span>
{!!total && (
<span class="count">
{shortenNumber(total)}