Append data always in future - Is this a bug? #789
Replies: 1 comment
-
|
the solution Summary of what was changed in frontend-v10/main.js:
callback(bars, { backward: true, forward: false }) → callback(bars, { backward: false, forward: true }). If oldestTimestampWeSent == null, call callback([], noMore) and return. Always callback([], noMore) and return (no extra newer history; live is from subscribeBar). Comment for oldestTimestampWeSent updated to say it’s used for forward (older bars), not backward. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
From the built bundle:
Backward (line 5335–5336):
case 'backward': {
this._dataList = this._dataList.concat(data); // appends 'data' at the END
Forward (line 5341–5342):
case 'forward': {
this._dataList = data.concat(this._dataList); // prepends 'data' at the BEGINNING
So:
Backward = “load older bars (to the left)”. Those should be prepended: data.concat(_dataList). The code does append (_dataList.concat(data)), so older bars end up on the right.

Forward = “load newer bars (to the right)”. Those should be appended: _dataList.concat(data). The code does prepend (data.concat(_dataList)), so newer bars would end up on the left.
So it’s a bug in v10: backward and forward merge logic are swapped. Reformatting or changing the backend won’t fix it; the chart will still put backward data at the end and forward at the start.
Beta Was this translation helpful? Give feedback.
All reactions