From 72c550802e77e81f4b9b969e5bd75057d6dbec42 Mon Sep 17 00:00:00 2001 From: Callum Macdonald Date: Mon, 25 Nov 2024 16:15:36 +0000 Subject: [PATCH] Ignore invalid events in redux. --- nr-app/src/redux/slices/events.slice.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/nr-app/src/redux/slices/events.slice.ts b/nr-app/src/redux/slices/events.slice.ts index 48ae027..388212b 100644 --- a/nr-app/src/redux/slices/events.slice.ts +++ b/nr-app/src/redux/slices/events.slice.ts @@ -1,5 +1,5 @@ import { ID_SEPARATOR } from "@/constants"; -import { Event } from "@common/mod"; +import { Event, isValidEvent } from "@common/mod"; import { createEntityAdapter, createSlice, @@ -75,6 +75,12 @@ export const eventsSlice = createSlice({ action: PayloadAction<{ event: Event; fromRelay: string }>, ) => { const { event, fromRelay: seenOnRelay } = action.payload; + + // Skip events which don't pass validation + if (!isValidEvent(event)) { + return; + } + const storageId = getStorageId(event); const eventWithMetadata = {