commit: 04acf069d1600f097805ce52f958263e68e153c1
parent 840ce063971d68063d380fc5f3aacc0564363b50
Author: Henry Jameson <me@hjkos.com>
Date: Tue, 16 Aug 2022 19:33:34 +0300
ignore invalid journal entries
Diffstat:
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/modules/serverSideStorage.js b/src/modules/serverSideStorage.js
@@ -132,7 +132,15 @@ export const _mergeFlags = (recent, stale, allFlagKeys) => {
}
const _mergeJournal = (...journals) => {
- const allJournals = flatten(journals.map(j => Array.isArray(j) ? j : []))
+ // Ignore invalid journal entries
+ const allJournals = flatten(
+ journals.map(j => Array.isArray(j) ? j : [])
+ ).filter(entry =>
+ Object.prototype.hasOwnProperty.call(entry, 'path') &&
+ Object.prototype.hasOwnProperty.call(entry, 'operation') &&
+ Object.prototype.hasOwnProperty.call(entry, 'args') &&
+ Object.prototype.hasOwnProperty.call(entry, 'timestamp')
+ )
const grouped = groupBy(allJournals, 'path')
const trimmedGrouped = Object.entries(grouped).map(([path, journal]) => {
// side effect