Fix profile cache invalidation after editing

Invalidate the in-memory profile cache for the user's pubkey after
publishing a new kind 0 event, so the updated profile reflects immediately.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Jure
2026-03-08 19:23:51 +01:00
parent b465ad03a3
commit a8a3581f9a
2 changed files with 7 additions and 1 deletions

View File

@@ -4,6 +4,11 @@ import { fetchProfile } from "../lib/nostr";
const profileCache = new Map<string, any>();
const pendingRequests = new Map<string, Promise<any>>();
export function invalidateProfileCache(pubkey: string) {
profileCache.delete(pubkey);
pendingRequests.delete(pubkey);
}
export function useProfile(pubkey: string) {
const [profile, setProfile] = useState<any>(profileCache.get(pubkey) ?? null);