chore: cleanup
This commit is contained in:
@ -27,7 +27,7 @@ const Tabs = ({ tabs, tab, setTab }: TabsProps) => {
|
|||||||
<div className="tabs">
|
<div className="tabs">
|
||||||
{tabs.map((t) => {
|
{tabs.map((t) => {
|
||||||
return (
|
return (
|
||||||
<div className={`tab ${tab.value === t.value ? "active" : ""}`} onClick={() => setTab(t)}>
|
<div key={t.value} className={`tab ${tab.value === t.value ? "active" : ""}`} onClick={() => setTab(t)}>
|
||||||
{t.text}
|
{t.text}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
@ -189,7 +189,7 @@ export class NostrSystem {
|
|||||||
console.debug("Wants profiles: ", missing);
|
console.debug("Wants profiles: ", missing);
|
||||||
|
|
||||||
let sub = new Subscriptions();
|
let sub = new Subscriptions();
|
||||||
sub.Id = `profiles:${sub.Id}`;
|
sub.Id = `profiles:${sub.Id.slice(0, 8)}`;
|
||||||
sub.Kinds = new Set([EventKind.SetMetadata]);
|
sub.Kinds = new Set([EventKind.SetMetadata]);
|
||||||
sub.Authors = missing;
|
sub.Authors = missing;
|
||||||
sub.OnEvent = async (e) => {
|
sub.OnEvent = async (e) => {
|
||||||
@ -199,13 +199,14 @@ export class NostrSystem {
|
|||||||
if ((existing?.created ?? 0) < profile.created) {
|
if ((existing?.created ?? 0) < profile.created) {
|
||||||
await this.UserDb!.put(profile);
|
await this.UserDb!.put(profile);
|
||||||
} else if (existing) {
|
} else if (existing) {
|
||||||
await this.UserDb!.update(profile.pubkey, { loaded: new Date().getTime() });
|
await this.UserDb!.update(profile.pubkey, { loaded: profile.loaded });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let results = await this.RequestSubscription(sub);
|
let results = await this.RequestSubscription(sub);
|
||||||
let couldNotFetch = Array.from(missing).filter(a => !results.some(b => b.pubkey === a));
|
let couldNotFetch = Array.from(missing).filter(a => !results.some(b => b.pubkey === a));
|
||||||
console.debug("No profiles: ", couldNotFetch);
|
console.debug("No profiles: ", couldNotFetch);
|
||||||
|
if (couldNotFetch.length > 0) {
|
||||||
await this.UserDb!.bulkPut(couldNotFetch.map(a => {
|
await this.UserDb!.bulkPut(couldNotFetch.map(a => {
|
||||||
return {
|
return {
|
||||||
pubkey: a,
|
pubkey: a,
|
||||||
@ -214,6 +215,7 @@ export class NostrSystem {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
setTimeout(() => this._FetchMetadata(), 500);
|
setTimeout(() => this._FetchMetadata(), 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user