Skip to content
Commits on Source (3)
{
"name": "i4-js-commons",
"version": "3.9.10",
"version": "3.9.11",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
......
{
"name": "i4-js-commons",
"version": "3.9.10",
"version": "3.9.11",
"description": "Just a load of common stuff for i4 front-ends and some probably usable in back-end as well",
"dependencies": {
"@material-ui/core": "^4.8.0",
......
......@@ -268,7 +268,7 @@ export const fromChannels = async ({
}); // -> [1, 2, 1, 1]
// console.log('counts:', counts);
const merged = datasetMerge(counts, histories);
// console.log('merged:', merged);
console.log('merged:', merged);
if (historyCb) historyCb(merged);
else if (cb) merged.map(cb);
if (noSub) return merged;
......@@ -277,9 +277,9 @@ export const fromChannels = async ({
? undefined
: Promise.all(
channels.map(({ rid, type, path }, idx) => {
// console.log('Sub-ing 1:', rid, type, path, counts, idx);
console.log('Sub-ing 1:', rid, type, path, counts, idx);
const [before, [_, ...after]] = R.splitAt(idx)(counts); // eslint-disable-line no-unused-vars
// console.log('Sub-ing 2:', before, after);
console.log('Sub-ing 2:', before, after);
const callback = R.compose(cb, conformPoint(before, after, path));
return fromChannel({
rid,
......
......@@ -129,7 +129,8 @@ const pointIntoChart = R.curry((chart, { length, ttl }, point) => {
remove = 1;
if (chronologicStart && chart.data.labels.length < length) remove = 0;
}
R.forEach(chart.data.labels.shift)(R.range(0, remove));
chart.data.labels.splice(0, remove);
// R.forEach(chart.data.labels.shift)(R.range(0, remove));
chart.data.labels.push(x);
// if (length && chronologicStart && chart.data.labels.length < length) remove = false;
// if (remove) chart.data.labels.shift();
......@@ -138,8 +139,8 @@ const pointIntoChart = R.curry((chart, { length, ttl }, point) => {
// if (!R.is(Object, val) && !R.is(Number, val) && !R.isNil(val)) val = { data: val };
// if (R.is(Object, val)) val.valueOf = () => 0;
ds.data.push(val);
// ds.data.splice(0, remove);
R.forEach(ds.data.shift)(R.range(0, remove));
ds.data.splice(0, remove);
// R.forEach(ds.data.shift)(R.range(0, remove));
// if (remove) ds.data.shift();
});
});
......@@ -196,7 +197,7 @@ export const Chart = ({
if (nilOrEmpty(point)) return;
pointIntoChart(chart.current, { length: length || 10, ttl }, point);
chart.current.update();
}, [point, length, ttl]);
}, [point]);
useEffect(() => {
if (nilOrEmpty(values)) return;
......
......@@ -37,16 +37,16 @@ export const withSubs = ({
const setter = useCallback(
msg => {
// console.log('WithSub setter:', doTransform, typeof channel.transform, msg);
console.log('WithSubs setter:', msg);
setPoint(prevData => (doTransform ? transform(msg, prevData) : msg));
},
[setPoint],
);
useEffect(() => {
// console.log('WithSub init-effect:', channels);
console.log('WithSubs init-effect:', channels);
if (!channels || channels.some(hasnt('rid'))) return undefined;
// console.log('WithSub will run fromChannels with:', channels, rest);
console.log('WithSubs will run fromChannels with:', channels, ttl, rest);
fromChannels({
channels,
ttl,
......