MetadataCache -> CachedMetadata, addCachedMetadataToFuzzySearch

This commit is contained in:
Martti Malmi
2024-01-08 16:12:05 +02:00
parent 88924941a5
commit c80eb25d29
20 changed files with 92 additions and 71 deletions

View File

@ -1,13 +1,13 @@
import { useContext, useSyncExternalStore } from "react";
import { HexKey, MetadataCache } from "@snort/system";
import { HexKey, CachedMetadata } from "@snort/system";
import { SnortContext } from "./context";
/**
* Gets a profile from cache or requests it from the relays
*/
export function useUserProfile(pubKey?: HexKey): MetadataCache | undefined {
export function useUserProfile(pubKey?: HexKey): CachedMetadata | undefined {
const system = useContext(SnortContext);
return useSyncExternalStore<MetadataCache | undefined>(
return useSyncExternalStore<CachedMetadata | undefined>(
h => {
if (pubKey) {
system.ProfileLoader.TrackKeys(pubKey);