fixed bug with old metadata being cached

This commit is contained in:
hzrd149 2023-02-20 21:07:10 -06:00
parent de3b1c123a
commit 66df230b22
3 changed files with 8 additions and 2 deletions

View File

@ -9,7 +9,10 @@ export class CachedPubkeyEventRequester extends PubkeyEventRequester {
async writeCache(pubkey: string, event: NostrEvent): Promise<any> {}
handleEvent(event: NostrEvent) {
this.writeCache(event.pubkey, event);
const sub = this.getSubject(event.pubkey);
if (!sub.value || event.created_at > sub.value.created_at) {
this.writeCache(event.pubkey, event);
}
super.handleEvent(event);
}

View File

@ -152,7 +152,7 @@ export const VerificationFailed = createIcon({
export const VerificationMissing = createIcon({
displayName: "VerificationFailed",
d: "M12 19c.828 0 1.5.672 1.5 1.5S12.828 22 12 22s-1.5-.672-1.5-1.5.672-1.5 1.5-1.5zm0-17c3.314 0 6 2.686 6 6 0 2.165-.753 3.29-2.674 4.923C13.399 14.56 13 15.297 13 17h-2c0-2.474.787-3.695 3.031-5.601C15.548 10.11 16 9.434 16 8c0-2.21-1.79-4-4-4S8 5.79 8 8v1H6V8c0-3.314 2.686-6 6-6z",
d: "M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10-4.477 10-10 10zm-1-7v2h2v-2h-2zm2-1.645A3.502 3.502 0 0 0 12 6.5a3.501 3.501 0 0 0-3.433 2.813l1.962.393A1.5 1.5 0 1 1 12 11.5a1 1 0 0 0-1 1V14h2v-.645z",
defaultProps,
});

View File

@ -64,6 +64,9 @@ const db = await openDB<CustomSchema>(dbName, version, {
export async function clearCacheData() {
await db.clear("userMetadata");
await db.clear("userContacts");
await db.clear("userFollows");
await db.clear("userRelays");
await db.clear("relayInfo");
await db.clear("dnsIdentifiers");
await db.clear("pubkeyRelayWeights");
window.location.reload();