mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-10 16:33:27 +00:00
refactor: drop cachedModificationEventsForNote, now a redundant alias
It existed to serve observeEdits a cheap synchronous value (an LRU read) distinct from the expensive IO-only findLatestModificationForNote cache scan. Since edits fold from Note.edits, findLatestModificationForNote is itself cheap and thread-safe, and cachedModificationEventsForNote had become a plain alias for it. observeEdits now calls findLatestModificationForNote directly — the same function observeNoteModifications already uses — and the LocalCache + AccountViewModel aliases are removed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013HdLnAa4Pa1pFV9FTYVTB6
This commit is contained in:
@@ -3268,8 +3268,6 @@ object LocalCache : ILocalCache, ICacheProvider {
|
||||
}.sortedWith(compareBy({ it.createdAt() }, { it.idHex }))
|
||||
}
|
||||
|
||||
fun cachedModificationEventsForNote(note: Note): List<Note> = findLatestModificationForNote(note)
|
||||
|
||||
/**
|
||||
* The kind-40003 Buzz edit currently overlaying [note], or null when unedited. Like every other
|
||||
* edit kind, only the ORIGINAL message author's edits count — the send side already gates Edit to
|
||||
|
||||
@@ -2062,7 +2062,7 @@ fun observeEdits(
|
||||
remember(baseNote.idHex) {
|
||||
// Edits are anchored on the note (Note.edits), so the current set is readable synchronously
|
||||
// (no cache scan) — start Empty or Loaded, never Loading.
|
||||
val cached = accountViewModel.cachedModificationEventsForNote(baseNote)
|
||||
val cached = LocalCache.findLatestModificationForNote(baseNote)
|
||||
mutableStateOf(
|
||||
if (cached.isEmpty()) {
|
||||
GenericLoadable.Empty()
|
||||
|
||||
-2
@@ -2037,8 +2037,6 @@ class AccountViewModel(
|
||||
|
||||
fun getAddressableNoteIfExists(key: Address): AddressableNote? = LocalCache.getAddressableNoteIfExists(key)
|
||||
|
||||
fun cachedModificationEventsForNote(note: Note): List<Note> = LocalCache.cachedModificationEventsForNote(note)
|
||||
|
||||
fun checkGetOrCreatePublicChatChannel(key: HexKey): PublicChatChannel = LocalCache.getOrCreatePublicChatChannel(key)
|
||||
|
||||
fun checkGetOrCreateLiveActivityChannel(key: Address): LiveActivitiesChannel = LocalCache.getOrCreateLiveChannel(key)
|
||||
|
||||
Reference in New Issue
Block a user