Error: Cannot add item: item with id NaN already exists
Closed this issue · 3 comments
I don't know if this is already working but i just tried it and it crashes with the following error:
Uncaught Error: Cannot add item: item with id NaN already exists
at t.value (vis-network.min.js:33:120883)
at t.value (vis-network.min.js:33:115512)
at new t (vis-network.min.js:33:114875)
at handleResponse (vis.html:128:18)
at vis.html:64:15
at timeout (puck.js:360:13)
it seems to happen at this place in the minified code:
key: "_addItem",
value: function(g) {
var A = function(g, A) {
return null == g[A] && (g[A] = Fp()),
g
}(g, this._idProp)
, t = A[this._idProp];
if (this._data.has(t))
throw new Error("Cannot add item: item with id " + t + " already exists");
return this._data.set(t, A),
++this.length,
t
Maybe you could look at what's in the array response
? Also maybe just try running it again?
I've only seen that error when there's been corrupt data received.
My array response
has 1048 entries and these are the last 10:
1039: {id: 2120, label: '"exports"', value: 2, flags: undefined}
1040: {id: 2134, label: '"BTHRM"', value: 3, flags: undefined}
1041: {id: 2146, label: '"time"', value: 2, flags: undefined}
1042: {id: 2156, label: '"\\xFFsco"', value: 2, flags: undefined}
1043: {id: 2212, label: '"time"', value: 2, flags: undefined}
1044: {id: NaN, label: undefined, value: NaN, flags: undefined}
1045: {id: NaN, label: '"chg":0}', value: NaN, flags: undefined}
1046: {id: NaN, label: undefined, value: NaN, flags: undefined}
1047: {id: NaN, label: '"hrm":80.9}', value: NaN, flags: undefined}
I crashes when processing entry 1045: {id: NaN, label: '"chg":0}', value: NaN, flags: undefined}
because id=NaN
is already existing in the target.
Maybe we can ignore entries with id=NaN
?
I tried to run it again and indeed after several tries it sometimes works.
Ahh - it's because you've got Gadgetbridge/Android installed and it's outputting health data right after you connect to the Bangle.
I guess we could wait after the connection...