refactor: Query emits Filters

This commit is contained in:
2024-01-09 12:51:33 +00:00
parent 18beed13c3
commit 4455651d47
40 changed files with 416 additions and 404 deletions

View File

@ -285,15 +285,20 @@ class IrisAccount extends Component<Props> {
componentDidMount() {
const session = LoginStore.snapshot();
const myPub = session.publicKey;
System.ProfileLoader.Cache.hook(() => {
const profile = System.ProfileLoader.Cache.getFromCache(myPub);
const irisToActive = profile && profile.nip05 && profile.nip05.endsWith("@iris.to");
this.setState({ profile, irisToActive });
if (profile && !irisToActive) {
this.checkExistingAccount(myPub);
}
}, myPub);
this.checkExistingAccount(myPub);
if (myPub) {
System.profileLoader.cache.on("change", keys => {
if (keys.includes(myPub)) {
const profile = System.profileLoader.cache.getFromCache(myPub);
const irisToActive = profile && profile.nip05 && profile.nip05.endsWith("@iris.to");
this.setState({ profile, irisToActive });
if (profile && !irisToActive) {
this.checkExistingAccount(myPub);
}
}
});
this.checkExistingAccount(myPub);
}
}
async checkExistingAccount(pub: any) {

View File

@ -18,7 +18,7 @@ export function ProfileLink({
children?: ReactNode;
} & Omit<LinkProps, "to">) {
const system = useContext(SnortContext);
const relays = system.RelayCache.getFromCache(pubkey)
const relays = system.relayCache.getFromCache(pubkey)
?.relays?.filter(a => a.settings.write)
?.map(a => a.url);