diff --git a/components/metrics/BrowsersTable.js b/components/metrics/BrowsersTable.js
index 97f9bfbd..3481449c 100644
--- a/components/metrics/BrowsersTable.js
+++ b/components/metrics/BrowsersTable.js
@@ -3,15 +3,15 @@ import { FormattedMessage } from 'react-intl';
import MetricsTable from './MetricsTable';
import { browserFilter } from 'lib/filters';
-export default function BrowsersTable({ websiteId, token, limit }) {
+export default function BrowsersTable({ websiteId, token, ...props }) {
return (
}
type="browser"
metric={}
websiteId={websiteId}
token={token}
- limit={limit}
dataFilter={browserFilter}
/>
);
diff --git a/components/metrics/CountriesTable.js b/components/metrics/CountriesTable.js
index d562b464..5b44bd23 100644
--- a/components/metrics/CountriesTable.js
+++ b/components/metrics/CountriesTable.js
@@ -5,7 +5,7 @@ import { FormattedMessage } from 'react-intl';
import useCountryNames from 'hooks/useCountryNames';
import useLocale from 'hooks/useLocale';
-export default function CountriesTable({ websiteId, token, limit, onDataLoad = () => {} }) {
+export default function CountriesTable({ websiteId, token, onDataLoad, ...props }) {
const [locale] = useLocale();
const countryNames = useCountryNames(locale);
@@ -15,13 +15,13 @@ export default function CountriesTable({ websiteId, token, limit, onDataLoad = (
return (
}
type="country"
metric={}
websiteId={websiteId}
token={token}
- limit={limit}
- onDataLoad={data => onDataLoad(percentFilter(data))}
+ onDataLoad={data => onDataLoad?.(percentFilter(data))}
renderLabel={renderLabel}
/>
);
diff --git a/components/metrics/DataTable.js b/components/metrics/DataTable.js
index 9e12d887..70eae89f 100644
--- a/components/metrics/DataTable.js
+++ b/components/metrics/DataTable.js
@@ -11,10 +11,10 @@ export default function DataTable({
title,
metric,
className,
- limit,
renderLabel,
height = 400,
animate = true,
+ virtualize = false,
}) {
const [format, setFormat] = useState(true);
const formatFunc = format ? formatLongNumber : formatNumber;
@@ -30,7 +30,7 @@ export default function DataTable({
label={renderLabel ? renderLabel(row) : label}
value={value}
percent={percent}
- animate={animate}
+ animate={animate && !virtualize}
format={formatFunc}
onClick={handleSetFormat}
/>
@@ -51,13 +51,13 @@ export default function DataTable({
{data?.length === 0 && }
- {limit
- ? data.map(row => getRow(row))
- : data.length > 0 && (
-
- {Row}
-
- )}
+ {virtualize && data.length > 0 ? (
+
+ {Row}
+
+ ) : (
+ data.map(row => getRow(row))
+ )}
);
diff --git a/components/metrics/DevicesTable.js b/components/metrics/DevicesTable.js
index 7d87d1c1..e71355db 100644
--- a/components/metrics/DevicesTable.js
+++ b/components/metrics/DevicesTable.js
@@ -4,15 +4,15 @@ import { deviceFilter } from 'lib/filters';
import { FormattedMessage } from 'react-intl';
import { getDeviceMessage } from 'components/messages';
-export default function DevicesTable({ websiteId, token, limit }) {
+export default function DevicesTable({ websiteId, token, ...props }) {
return (
}
type="device"
metric={}
websiteId={websiteId}
token={token}
- limit={limit}
dataFilter={deviceFilter}
renderLabel={({ x }) => getDeviceMessage(x)}
/>
diff --git a/components/metrics/EventsTable.js b/components/metrics/EventsTable.js
index 43b52c4d..73df5028 100644
--- a/components/metrics/EventsTable.js
+++ b/components/metrics/EventsTable.js
@@ -3,17 +3,16 @@ import { FormattedMessage } from 'react-intl';
import MetricsTable from './MetricsTable';
import Tag from 'components/common/Tag';
-export default function EventsTable({ websiteId, token, limit, onDataLoad }) {
+export default function EventsTable({ websiteId, token, ...props }) {
return (
}
type="event"
metric={}
websiteId={websiteId}
token={token}
- limit={limit}
renderLabel={({ x }) => }
- onDataLoad={onDataLoad}
/>
);
}
diff --git a/components/metrics/MetricsTable.js b/components/metrics/MetricsTable.js
index 19cd5b95..9a117afd 100644
--- a/components/metrics/MetricsTable.js
+++ b/components/metrics/MetricsTable.js
@@ -24,9 +24,11 @@ export default function MetricsTable({
dataFilter,
filterOptions,
limit,
+ virtualize,
renderLabel,
height,
- onDataLoad = () => {},
+ onDataLoad,
+ ...props
}) {
const [dateRange] = useDateRange(websiteId);
const { startDate, endDate, modified } = dateRange;
@@ -70,14 +72,14 @@ export default function MetricsTable({
{error && }
{data && !error && (
0}
+ virtualize={virtualize}
/>
)}
diff --git a/components/metrics/PagesTable.js b/components/metrics/PagesTable.js
index 0acda811..0740992c 100644
--- a/components/metrics/PagesTable.js
+++ b/components/metrics/PagesTable.js
@@ -10,7 +10,7 @@ import usePageQuery from 'hooks/usePageQuery';
import MetricsTable from './MetricsTable';
import styles from './PagesTable.module.css';
-export default function PagesTable({ websiteId, token, websiteDomain, limit, showFilters }) {
+export default function PagesTable({ websiteId, token, websiteDomain, showFilters, ...props }) {
const [filter, setFilter] = useState(FILTER_COMBINED);
const {
resolve,
@@ -49,10 +49,10 @@ export default function PagesTable({ websiteId, token, websiteDomain, limit, sho
metric={}
websiteId={websiteId}
token={token}
- limit={limit}
dataFilter={urlFilter}
filterOptions={{ domain: websiteDomain, raw: filter === FILTER_RAW }}
renderLabel={renderLink}
+ {...props}
/>
>
);
diff --git a/components/metrics/ReferrersTable.js b/components/metrics/ReferrersTable.js
index df7a8c15..0543f17e 100644
--- a/components/metrics/ReferrersTable.js
+++ b/components/metrics/ReferrersTable.js
@@ -6,7 +6,7 @@ import ButtonGroup from 'components/common/ButtonGroup';
import { FILTER_DOMAIN_ONLY, FILTER_COMBINED, FILTER_RAW } from 'lib/constants';
import ButtonLayout from '../layout/ButtonLayout';
-export default function ReferrersTable({ websiteId, websiteDomain, token, limit, showFilters }) {
+export default function ReferrersTable({ websiteId, websiteDomain, token, showFilters, ...props }) {
const [filter, setFilter] = useState(FILTER_COMBINED);
const buttons = [
@@ -35,13 +35,13 @@ export default function ReferrersTable({ websiteId, websiteDomain, token, limit,
<>
{showFilters && }
}
type="referrer"
metric={}
websiteId={websiteId}
websiteDomain={websiteDomain}
token={token}
- limit={limit}
dataFilter={refFilter}
filterOptions={{
domain: websiteDomain,
diff --git a/components/pages/RealtimeDashboard.js b/components/pages/RealtimeDashboard.js
index d80304d9..33689086 100644
--- a/components/pages/RealtimeDashboard.js
+++ b/components/pages/RealtimeDashboard.js
@@ -1,19 +1,19 @@
import React, { useState, useEffect, useMemo, useCallback } from 'react';
+import { FormattedMessage } from 'react-intl';
import { subMinutes, startOfMinute } from 'date-fns';
import firstBy from 'thenby';
-import { percentFilter } from 'lib/filters';
import Page from 'components/layout/Page';
import GridLayout, { GridRow, GridColumn } from 'components/layout/GridLayout';
-import RealtimeChart from '../metrics/RealtimeChart';
-import RealtimeLog from '../metrics/RealtimeLog';
-import styles from './RealtimeDashboard.module.css';
-import RealtimeHeader from '../metrics/RealtimeHeader';
+import RealtimeChart from 'components/metrics/RealtimeChart';
+import RealtimeLog from 'components/metrics/RealtimeLog';
+import RealtimeHeader from 'components/metrics/RealtimeHeader';
+import WorldMap from 'components/common/WorldMap';
+import DataTable from 'components/metrics/DataTable';
import useFetch from 'hooks/useFetch';
-import WorldMap from '../common/WorldMap';
-import DataTable from '../metrics/DataTable';
import useLocale from 'hooks/useLocale';
import useCountryNames from 'hooks/useCountryNames';
-import { FormattedMessage } from 'react-intl';
+import { percentFilter } from 'lib/filters';
+import styles from './RealtimeDashboard.module.css';
const REALTIME_RANGE = 30;
const REALTIME_INTERVAL = 3000;
@@ -162,7 +162,6 @@ export default function RealtimeDashboard() {
metric={}
data={referrers}
height={400}
- animate={false}
/>
@@ -177,7 +176,6 @@ export default function RealtimeDashboard() {
data={countries}
renderLabel={renderCountryName}
height={500}
- animate={false}
/>
diff --git a/components/pages/WebsiteDetails.js b/components/pages/WebsiteDetails.js
index 39b634e5..ddbbbc21 100644
--- a/components/pages/WebsiteDetails.js
+++ b/components/pages/WebsiteDetails.js
@@ -164,14 +164,14 @@ export default function WebsiteDetails({ websiteId, token }) {
)}
- {view && (
+ {view && chartLoaded && (
-
+
)}
diff --git a/pages/api/website/[id]/metrics.js b/pages/api/website/[id]/metrics.js
index 17aa6daa..2aca489f 100644
--- a/pages/api/website/[id]/metrics.js
+++ b/pages/api/website/[id]/metrics.js
@@ -55,7 +55,7 @@ export default async (req, res) => {
getColumn(type),
getTable(type),
{
- domain,
+ domain: type !== 'event' && domain,
url: type !== 'url' && url,
},
);