Skip to content

Commit 3878d89

Browse files
committed
fix bad replaceable event write
1 parent 30d3ce6 commit 3878d89

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

ndk-mobile/src/stores/session.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,13 @@ export const useSessionStore = create<SessionState>((set) => ({
5959
// safety check for replaceable events
6060
if (event.isReplaceable()) {
6161
const existingEvent = existing.find((e) => e.dTag === event.dTag)
62-
if (existingEvent && existingEvent.created_at >= event.created_at) {
63-
return state
64-
} else {
65-
// remove the existing event
66-
existing = existing.filter((e) => e.id !== existingEvent.id)
62+
if (existingEvent) {
63+
if (existingEvent.created_at >= event.created_at) {
64+
return state
65+
} else {
66+
// remove the existing event
67+
existing = existing.filter((e) => e.id !== existingEvent.id)
68+
}
6769
}
6870
}
6971

0 commit comments

Comments
 (0)