store: add note about comparison in Buffer.put

This commit is contained in:
Simon Ser 2022-02-12 10:24:34 +01:00
parent 2ac7be6218
commit a3eec9a351

View file

@ -87,6 +87,8 @@ export class Buffer {
let receipts = { ...prev.receipts }; let receipts = { ...prev.receipts };
if (buf.receipts) { if (buf.receipts) {
Object.keys(buf.receipts).forEach((k) => { Object.keys(buf.receipts).forEach((k) => {
// Use a not-equals comparison here so that no-op receipt
// changes are correctly handled
if (!receipts[k] || receipts[k].time < buf.receipts[k].time) { if (!receipts[k] || receipts[k].time < buf.receipts[k].time) {
receipts[k] = buf.receipts[k]; receipts[k] = buf.receipts[k];
updated = true; updated = true;