mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-25 01:08:50 +01:00
Fix history key might be undefined in hashtag object
And some other fixes
This commit is contained in:
parent
2ad72a667d
commit
810596b7cf
1 changed files with 5 additions and 5 deletions
|
@ -253,21 +253,21 @@ function Search(props) {
|
||||||
<ul class="link-list hashtag-list">
|
<ul class="link-list hashtag-list">
|
||||||
{hashtagResults.map((hashtag) => {
|
{hashtagResults.map((hashtag) => {
|
||||||
const { name, history } = hashtag;
|
const { name, history } = hashtag;
|
||||||
const total = history.reduce(
|
const total = history?.reduce?.(
|
||||||
(acc, cur) => acc + +cur.uses,
|
(acc, cur) => acc + +cur.uses,
|
||||||
0,
|
0,
|
||||||
);
|
);
|
||||||
return (
|
return (
|
||||||
<li key={hashtag.name}>
|
<li key={`${name}-${total}`}>
|
||||||
<Link
|
<Link
|
||||||
to={
|
to={
|
||||||
instance
|
instance
|
||||||
? `/${instance}/t/${hashtag.name}`
|
? `/${instance}/t/${name}`
|
||||||
: `/t/${hashtag.name}`
|
: `/t/${name}`
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<Icon icon="hashtag" />
|
<Icon icon="hashtag" />
|
||||||
<span>{hashtag.name}</span>
|
<span>{name}</span>
|
||||||
{!!total && (
|
{!!total && (
|
||||||
<span class="count">
|
<span class="count">
|
||||||
{shortenNumber(total)}
|
{shortenNumber(total)}
|
||||||
|
|
Loading…
Reference in a new issue