sdk: automatically store replaceable events since we already check the local store for them.

This commit is contained in:
fiatjaf
2025-12-21 22:14:59 -03:00
parent dd6d3c68fb
commit 99197d8321
4 changed files with 14 additions and 1 deletions

View File

@@ -73,6 +73,7 @@ func fetchGenericList[V comparable, I TagItemWithValue[V]](
newV := tryFetchListFromNetwork(ctx, sys, pubkey, replaceableIndex, parseTag)
if newV != nil && newV.Event.CreatedAt > v.Event.CreatedAt {
v = *newV
sys.Store.ReplaceEvent(*v.Event)
}
// register this even if we didn't find anything because we tried
@@ -93,6 +94,7 @@ func fetchGenericList[V comparable, I TagItemWithValue[V]](
// we'll only save this if we got something which means we found at least one event
lastFetchKey := makeLastFetchKey(actualKind, pubkey)
sys.KVStore.Set(lastFetchKey, encodeTimestamp(nostr.Now()))
sys.Store.SaveEvent(*v.Event)
}
// save cache even if we didn't get anything