mirror of
https://github.com/dergigi/boris.git
synced 2025-12-18 15:14:20 +01:00
fix: check localStorage cache before querying relays for articles
Previously, articles always loaded from relays on browser refresh because: - EventStore is in-memory only and doesn't persist - localStorage cache was only checked as last resort after relay queries failed Now we check the localStorage cache immediately after EventStore, before querying relays. This allows instant article loading from cache on refresh without unnecessary relay queries.
This commit is contained in:
@@ -34,7 +34,7 @@ function getCacheKey(naddr: string): string {
|
||||
return `${CACHE_PREFIX}${naddr}`
|
||||
}
|
||||
|
||||
function getFromCache(naddr: string): ArticleContent | null {
|
||||
export function getFromCache(naddr: string): ArticleContent | null {
|
||||
try {
|
||||
const cacheKey = getCacheKey(naddr)
|
||||
const cached = localStorage.getItem(cacheKey)
|
||||
|
||||
Reference in New Issue
Block a user