From 358c725828c2492f99bbe7dc99413064a53fea61 Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Thu, 21 Jul 2022 01:35:14 -0700 Subject: [PATCH] Fix issue with unicode filtering. Closes #1258 --- components/metrics/FilterTags.js | 3 ++- pages/api/website/[id]/stats.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/components/metrics/FilterTags.js b/components/metrics/FilterTags.js index 077053d0..5b8ed63c 100644 --- a/components/metrics/FilterTags.js +++ b/components/metrics/FilterTags.js @@ -2,6 +2,7 @@ import React from 'react'; import classNames from 'classnames'; import Button from 'components/common/Button'; import Times from 'assets/times.svg'; +import { safeDecodeURI } from 'lib/url'; import styles from './FilterTags.module.css'; export default function FilterTags({ params, onClick }) { @@ -17,7 +18,7 @@ export default function FilterTags({ params, onClick }) { return (
); diff --git a/pages/api/website/[id]/stats.js b/pages/api/website/[id]/stats.js index 7f37574c..bd32c79d 100644 --- a/pages/api/website/[id]/stats.js +++ b/pages/api/website/[id]/stats.js @@ -41,7 +41,7 @@ export default async (req, res) => { const stats = Object.keys(metrics[0]).reduce((obj, key) => { obj[key] = { value: Number(metrics[0][key]) || 0, - change: Number(metrics[0][key] - prevPeriod[0][key]) || 0, + change: Number(metrics[0][key]) - Number(prevPeriod[0][key]) || 0, }; return obj; }, {});