Skip to content

Commit c11e804

Browse files
authored
Merge pull request #922 from acelaya-forks/tag-from-params
For tags header, fallback to params for the tag name
2 parents f6979c1 + 2263b28 commit c11e804

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/visits/TagVisitsHeader.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { useParams } from 'react-router';
12
import { Tag } from '../tags/helpers/Tag';
23
import type { ColorGenerator } from '../utils/services/ColorGenerator';
34
import type { TagVisits } from './reducers/tagVisits';
@@ -9,11 +10,12 @@ interface TagVisitsHeaderProps {
910
}
1011

1112
export const TagVisitsHeader = ({ tagVisits, colorGenerator }: TagVisitsHeaderProps) => {
12-
const { tag, visits = [] } = tagVisits.status === 'loaded' ? tagVisits : {};
13+
const { tag: tagFromPath = '' } = useParams();
14+
const { visits = [], tag = tagFromPath } = tagVisits.status === 'loaded' ? tagVisits : {};
1315
const visitsStatsTitle = (
1416
<span className="flex items-center justify-center">
1517
<span className="mr-2">Visits for</span>
16-
{tag && <Tag text={tag} colorGenerator={colorGenerator} />}
18+
<Tag text={tag} colorGenerator={colorGenerator} />
1719
</span>
1820
);
1921

0 commit comments

Comments
 (0)