Fix localStorage Max

This commit is contained in:
naielv
2025-06-18 11:33:42 +02:00
parent 8056fbdb71
commit b80f7e01e9

View File

@@ -1825,9 +1825,10 @@
}); });
root.on('put', function(msg){ root.on('put', function(msg){
var put = msg.put, soul = put['#'], key = put['.'], id = msg['#'], ok = msg.ok||'', tmp; // pull data off wire envelope
if (!(root.next || '')[soul]) return;
this.to.next(msg); // remember to call next middleware adapter this.to.next(msg); // remember to call next middleware adapter
var put = msg.put, soul = put['#'], key = put['.'], id = msg['#'], ok = msg.ok||'', tmp; // pull data off wire envelope
if (!(soul.startsWith(TABLE))) return; // fix https://github.com/amark/gun/issues/1377
console.warn(TABLE, soul)
disk[soul] = Gun.state.ify(disk[soul], key, put['>'], put[':'], soul); // merge into disk object disk[soul] = Gun.state.ify(disk[soul], key, put['>'], put[':'], soul); // merge into disk object
if(stop && size > (4999880)){ root.on('in', {'@': id, err: "localStorage max!"}); return; } if(stop && size > (4999880)){ root.on('in', {'@': id, err: "localStorage max!"}); return; }
//if(!msg['@']){ acks.push(id) } // then ack any non-ack write. // TODO: use batch id. //if(!msg['@']){ acks.push(id) } // then ack any non-ack write. // TODO: use batch id.