feat: automated outbox model

This commit is contained in:
2023-11-22 13:58:11 +00:00
parent a80c330e5b
commit a67263e5e1
11 changed files with 219 additions and 208 deletions

View File

@ -1,4 +1,4 @@
import { createContext } from "react";
import { NostrSystem, SystemInterface } from "@snort/system";
export const SnortContext = createContext<SystemInterface>(new NostrSystem({}));
export const SnortContext = createContext<SystemInterface>({} as SystemInterface);

View File

@ -10,13 +10,13 @@ export function useUserProfile(pubKey?: HexKey): MetadataCache | undefined {
return useSyncExternalStore<MetadataCache | undefined>(
h => {
if (pubKey) {
system.ProfileLoader.TrackMetadata(pubKey);
system.ProfileLoader.TrackKeys(pubKey);
}
const release = system.ProfileLoader.Cache.hook(h, pubKey);
return () => {
release();
if (pubKey) {
system.ProfileLoader.UntrackMetadata(pubKey);
system.ProfileLoader.UntrackKeys(pubKey);
}
};
},