chore: cleanup

This commit is contained in:
Kieran 2023-02-06 23:06:55 +00:00
parent 22479d8ec0
commit 7dc9887754
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941
2 changed files with 19 additions and 17 deletions

View File

@ -14,8 +14,8 @@ interface TabElementProps extends Omit<TabsProps, 'tabs'> {
t: Tab
}
export const TabElement = ({ t, tab, setTab }: TabElementProps) => {
return (
export const TabElement = ({ t, tab, setTab }: TabElementProps) => {
return (
<div className={`tab ${tab.value === t.value ? "active" : ""}`} onClick={() => setTab(t)}>
{t.text}
</div>
@ -25,13 +25,13 @@ export const TabElement = ({ t, tab, setTab }: TabElementProps) => {
const Tabs = ({ tabs, tab, setTab }: TabsProps) => {
return (
<div className="tabs">
{tabs.map((t) => {
return (
<div className={`tab ${tab.value === t.value ? "active" : ""}`} onClick={() => setTab(t)}>
{t.text}
</div>
)
})}
{tabs.map((t) => {
return (
<div key={t.value} className={`tab ${tab.value === t.value ? "active" : ""}`} onClick={() => setTab(t)}>
{t.text}
</div>
)
})}
</div>
)
}

View File

@ -189,7 +189,7 @@ export class NostrSystem {
console.debug("Wants profiles: ", missing);
let sub = new Subscriptions();
sub.Id = `profiles:${sub.Id}`;
sub.Id = `profiles:${sub.Id.slice(0, 8)}`;
sub.Kinds = new Set([EventKind.SetMetadata]);
sub.Authors = missing;
sub.OnEvent = async (e) => {
@ -199,19 +199,21 @@ export class NostrSystem {
if ((existing?.created ?? 0) < profile.created) {
await this.UserDb!.put(profile);
} 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 couldNotFetch = Array.from(missing).filter(a => !results.some(b => b.pubkey === a));
console.debug("No profiles: ", couldNotFetch);
await this.UserDb!.bulkPut(couldNotFetch.map(a => {
return {
pubkey: a,
loaded: new Date().getTime()
} as MetadataCache;
}));
if (couldNotFetch.length > 0) {
await this.UserDb!.bulkPut(couldNotFetch.map(a => {
return {
pubkey: a,
loaded: new Date().getTime()
} as MetadataCache;
}));
}
}
}
setTimeout(() => this._FetchMetadata(), 500);