From cb469ba669cba979bb7cee9ab11b6048bd3fa93b Mon Sep 17 00:00:00 2001 From: Zbynek Konecny Date: Sun, 6 Jun 2021 13:52:03 +0200 Subject: [PATCH] Use ResizeObserver polyfill in older browsers --- package-lock.json | 12 +++++++++++- package.json | 1 + src/components/LineChart.jsx | 2 ++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 0f8bce009..62520951f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,6 +11,7 @@ "dependencies": { "@babel/core": "^7.14.3", "@halkeye/react-paginate": "^7.2.3", + "@juggle/resize-observer": "^3.3.1", "@sentry/browser": "^6.5.1", "algoliasearch": "^4.9.1", "chart.js": "^3.3.2", @@ -18,7 +19,6 @@ "classnames": "^2.3.1", "copy-to-clipboard": "^3.3.1", "find-package-json": "^1.2.0", - "fsevents": "2.3.2", "gatsby-plugin-canonical-urls": "^3.6.0", "gatsby-plugin-image": "^1.6.0", "gatsby-plugin-postcss": "^4.6.0", @@ -3120,6 +3120,11 @@ "regenerator-runtime": "^0.13.3" } }, + "node_modules/@juggle/resize-observer": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/@juggle/resize-observer/-/resize-observer-3.3.1.tgz", + "integrity": "sha512-zMM9Ds+SawiUkakS7y94Ymqx+S0ORzpG3frZirN3l+UlXUmSUR7hF4wxCVqW+ei94JzV5kt0uXBcoOEAuiydrw==" + }, "node_modules/@mdx-js/util": { "version": "2.0.0-next.8", "resolved": "https://registry.npmjs.org/@mdx-js/util/-/util-2.0.0-next.8.tgz", @@ -41699,6 +41704,11 @@ "regenerator-runtime": "^0.13.3" } }, + "@juggle/resize-observer": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/@juggle/resize-observer/-/resize-observer-3.3.1.tgz", + "integrity": "sha512-zMM9Ds+SawiUkakS7y94Ymqx+S0ORzpG3frZirN3l+UlXUmSUR7hF4wxCVqW+ei94JzV5kt0uXBcoOEAuiydrw==" + }, "@mdx-js/util": { "version": "2.0.0-next.8", "resolved": "https://registry.npmjs.org/@mdx-js/util/-/util-2.0.0-next.8.tgz", diff --git a/package.json b/package.json index e9887f2fe..1b4de314a 100644 --- a/package.json +++ b/package.json @@ -63,6 +63,7 @@ "dependencies": { "@babel/core": "^7.14.3", "@halkeye/react-paginate": "^7.2.3", + "@juggle/resize-observer": "^3.3.1", "@sentry/browser": "^6.5.1", "algoliasearch": "^4.9.1", "chart.js": "^3.3.2", diff --git a/src/components/LineChart.jsx b/src/components/LineChart.jsx index ad21ab784..c2969b74b 100644 --- a/src/components/LineChart.jsx +++ b/src/components/LineChart.jsx @@ -2,6 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import {Line} from 'react-chartjs-2'; import moment from 'moment'; +import {ResizeObserver as ResizeObserverPolyfill} from '@juggle/resize-observer'; const calculateMax = (data) => { return 1.2 * Math.max(...data); @@ -63,6 +64,7 @@ const styles = { }; function LineChart({installations}) { + window.ResizeObserver = window.ResizeObserver || ResizeObserverPolyfill; if (!installations) { return null; }