Gun: Fix bug on no data

This commit is contained in:
Mitra Ardron 2018-07-16 19:59:07 -07:00
parent 7de53f74ca
commit e13af1a495

View File

@ -147,7 +147,7 @@ class TransportGUN extends Transport {
let g = this.connection(url, verbose); let g = this.connection(url, verbose);
if (!current) { // See TODO-GUN-CURRENT have to keep an extra copy to compare for which calls are new. if (!current) { // See TODO-GUN-CURRENT have to keep an extra copy to compare for which calls are new.
g.once(data => { g.once(data => {
this.monitored = Object.keys(data) || []; // Keep a copy - could actually just keep high water mark unless getting partial knowledge of state of array. this.monitored = data ? Object.keys(data) : []; // Keep a copy - could actually just keep high water mark unless getting partial knowledge of state of array.
g.map().on((v, k) => { g.map().on((v, k) => {
if (!(this.monitored.includes(k)) && (k !== '_')) { //See TODO-GUN-UNDERSCORE if (!(this.monitored.includes(k)) && (k !== '_')) { //See TODO-GUN-UNDERSCORE
this.monitored.push(k) this.monitored.push(k)