Fixed bug with realtime links.

This commit is contained in:
Mike Cao 2020-11-28 14:15:14 -08:00
parent 1b172d214b
commit 54cb5d849f

View File

@ -13,7 +13,10 @@ export default function RealtimeViews({ websiteId, data, websites }) {
const [filter, setFilter] = useState(FILTER_REFERRERS); const [filter, setFilter] = useState(FILTER_REFERRERS);
const domains = useMemo(() => websites.map(({ domain }) => domain), [websites]); const domains = useMemo(() => websites.map(({ domain }) => domain), [websites]);
const getDomain = useCallback( const getDomain = useCallback(
id => websites.find(({ website_id }) => website_id === id)?.domain, id =>
websites.length === 1
? websites[0]?.domain
: websites.find(({ website_id }) => website_id === id)?.domain,
[websites], [websites],
); );