react-icecream-charts
Advanced tools
Comparing version 0.10.2 to 0.10.3
@@ -56,3 +56,4 @@ import Highcharts from 'highcharts'; | ||
} | ||
} | ||
}, | ||
reflow: false | ||
}, | ||
@@ -59,0 +60,0 @@ lang: createHighLangOptions(langData.langOptions), |
@@ -5,2 +5,4 @@ import { useEffect, useImperativeHandle, useLayoutEffect, useRef } from 'react'; | ||
import memoize from 'lodash.memoize'; | ||
import { addListener, removeListener } from 'resize-detector'; | ||
import debounce from 'lodash.debounce'; | ||
import { useUnstableEvent } from './utils/hooks'; | ||
@@ -83,2 +85,17 @@ var loadHighstock = memoize(function (langOptions) { return import('highcharts/highstock').then(function (Highstock) { | ||
useEffect(function () { return function () { var _a; return (_a = chartRef.current) === null || _a === void 0 ? void 0 : _a.destroy(); }; }, []); | ||
useLayoutEffect(function () { | ||
var renderDom = renderToRef.current; | ||
var debouncedReflowChart = debounce(function () { | ||
var _a; | ||
(_a = chartRef.current) === null || _a === void 0 ? void 0 : _a.reflow(); | ||
}, 200); | ||
if (renderDom) { | ||
addListener(renderDom, debouncedReflowChart); | ||
} | ||
return function () { | ||
if (renderDom) { | ||
removeListener(renderDom, debouncedReflowChart); | ||
} | ||
}; | ||
}, []); | ||
return [renderToRef, createChartRef]; | ||
@@ -85,0 +102,0 @@ } |
@@ -72,3 +72,4 @@ "use strict"; | ||
} | ||
} | ||
}, | ||
reflow: false | ||
}, | ||
@@ -75,0 +76,0 @@ lang: chart_1.createHighLangOptions(langData.langOptions), |
@@ -30,2 +30,4 @@ "use strict"; | ||
var lodash_memoize_1 = __importDefault(require("lodash.memoize")); | ||
var resize_detector_1 = require("resize-detector"); | ||
var lodash_debounce_1 = __importDefault(require("lodash.debounce")); | ||
var hooks_1 = require("./utils/hooks"); | ||
@@ -108,2 +110,17 @@ var loadHighstock = lodash_memoize_1.default(function (langOptions) { return Promise.resolve().then(function () { return __importStar(require('highcharts/highstock')); }).then(function (Highstock) { | ||
react_1.useEffect(function () { return function () { var _a; return (_a = chartRef.current) === null || _a === void 0 ? void 0 : _a.destroy(); }; }, []); | ||
react_1.useLayoutEffect(function () { | ||
var renderDom = renderToRef.current; | ||
var debouncedReflowChart = lodash_debounce_1.default(function () { | ||
var _a; | ||
(_a = chartRef.current) === null || _a === void 0 ? void 0 : _a.reflow(); | ||
}, 200); | ||
if (renderDom) { | ||
resize_detector_1.addListener(renderDom, debouncedReflowChart); | ||
} | ||
return function () { | ||
if (renderDom) { | ||
resize_detector_1.removeListener(renderDom, debouncedReflowChart); | ||
} | ||
}; | ||
}, []); | ||
return [renderToRef, createChartRef]; | ||
@@ -110,0 +127,0 @@ } |
{ | ||
"name": "react-icecream-charts", | ||
"version": "0.10.2", | ||
"version": "0.10.3", | ||
"license": "MIT", | ||
@@ -40,4 +40,6 @@ "main": "esm/index.js", | ||
"icecream-base": "^0.0.4", | ||
"lodash.debounce": "^4.0.8", | ||
"lodash.memoize": "~4.1.2", | ||
"lodash.mergewith": "^4.6.2" | ||
"lodash.mergewith": "^4.6.2", | ||
"resize-detector": "^0.3.0" | ||
}, | ||
@@ -52,2 +54,3 @@ "peerDependencies": { | ||
"@types/jest": "^25.1.4", | ||
"@types/lodash.debounce": "^4.0.7", | ||
"@types/lodash.memoize": "^4.1.2", | ||
@@ -54,0 +57,0 @@ "@types/lodash.mergewith": "^4.6.6", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4795734
8
27
273
144038
1
+ Addedlodash.debounce@^4.0.8
+ Addedresize-detector@^0.3.0
+ Addedlodash.debounce@4.0.8(transitive)
+ Addedresize-detector@0.3.0(transitive)