binbot-charts 0.2.42 → 0.2.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -15,7 +15,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
15
15
|
|
|
16
16
|
var _useImmer = require("use-immer");
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _helpers = require("./helpers");
|
|
19
19
|
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
21
|
|
|
@@ -38,7 +38,7 @@ function TVChartContainer(_ref) {
|
|
|
38
38
|
const [chartOrderLines, setChartOrderLines] = (0, _useImmer.useImmer)([]);
|
|
39
39
|
const [widgetState, setWidgetState] = (0, _useImmer.useImmer)(null);
|
|
40
40
|
const [symbolState] = (0, _react.useState)(null);
|
|
41
|
-
const prevStates = (0,
|
|
41
|
+
const prevStates = (0, _helpers.usePrevious)({
|
|
42
42
|
timescaleMarks
|
|
43
43
|
});
|
|
44
44
|
(0, _react.useEffect)(() => {
|
|
@@ -54,10 +54,10 @@ function TVChartContainer(_ref) {
|
|
|
54
54
|
widgetState.setSymbol(symbol, interval);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
if (prevStates && prevStates.timescaleMarks !== timescaleMarks) {
|
|
57
|
+
if (prevStates !== null && prevStates !== void 0 && prevStates.timescaleMarks && timescaleMarks !== prevStates.timescaleMarks) {
|
|
58
58
|
initializeChart();
|
|
59
59
|
}
|
|
60
|
-
}, [orderLines]);
|
|
60
|
+
}, [orderLines, prevStates]);
|
|
61
61
|
|
|
62
62
|
const initializeChart = () => {
|
|
63
63
|
const widgetOptions = {
|
|
@@ -5,6 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getAllSymbols = getAllSymbols;
|
|
7
7
|
exports.makeApiRequest = makeApiRequest;
|
|
8
|
+
exports.usePrevious = usePrevious;
|
|
9
|
+
|
|
10
|
+
var _react = require("react");
|
|
8
11
|
|
|
9
12
|
async function makeApiRequest(path) {
|
|
10
13
|
try {
|
|
@@ -37,4 +40,12 @@ async function getAllSymbols(symbol) {
|
|
|
37
40
|
}
|
|
38
41
|
|
|
39
42
|
return newSymbols;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function usePrevious(value) {
|
|
46
|
+
const ref = (0, _react.useRef)();
|
|
47
|
+
(0, _react.useEffect)(() => {
|
|
48
|
+
ref.current = value;
|
|
49
|
+
});
|
|
50
|
+
return ref.current;
|
|
40
51
|
}
|
package/package.json
CHANGED
package/dist/components/hooks.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.usePrevious = usePrevious;
|
|
7
|
-
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
|
|
10
|
-
function usePrevious(value) {
|
|
11
|
-
const ref = (0, _react.useRef)();
|
|
12
|
-
(0, _react.useEffect)(() => {
|
|
13
|
-
ref.current = value;
|
|
14
|
-
});
|
|
15
|
-
return ref.current;
|
|
16
|
-
}
|