Skip to content

Commit 72c5508

Browse files
committed
Ignore invalid events in redux.
1 parent 28723c4 commit 72c5508

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

nr-app/src/redux/slices/events.slice.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ID_SEPARATOR } from "@/constants";
2-
import { Event } from "@common/mod";
2+
import { Event, isValidEvent } from "@common/mod";
33
import {
44
createEntityAdapter,
55
createSlice,
@@ -75,6 +75,12 @@ export const eventsSlice = createSlice({
7575
action: PayloadAction<{ event: Event; fromRelay: string }>,
7676
) => {
7777
const { event, fromRelay: seenOnRelay } = action.payload;
78+
79+
// Skip events which don't pass validation
80+
if (!isValidEvent(event)) {
81+
return;
82+
}
83+
7884
const storageId = getStorageId(event);
7985

8086
const eventWithMetadata = {

0 commit comments

Comments
 (0)