system-worker progress

This commit is contained in:
2024-01-09 09:28:48 +00:00
parent 24e145a0a0
commit bbdfb43834
10 changed files with 124 additions and 53 deletions

View File

@ -4,7 +4,7 @@ import { FormattedMessage } from "react-intl";
import { injectIntl } from "react-intl";
import messages from "@/Components/messages";
import { ProfileLoader } from "@/system";
import { System } from "@/system";
import { LoginStore } from "@/Utils/Login";
import AccountName from "./AccountName";
@ -285,8 +285,8 @@ class IrisAccount extends Component<Props> {
componentDidMount() {
const session = LoginStore.snapshot();
const myPub = session.publicKey;
ProfileLoader.Cache.hook(() => {
const profile = ProfileLoader.Cache.getFromCache(myPub);
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) {

View File

@ -28,7 +28,7 @@ export function useRefreshFeedCache<T>(c: RefreshFeedCache<T>, leaveOpen = false
const q = system.Query(NoopStore, sub);
let t: ReturnType<typeof setTimeout> | undefined;
let tBuf: Array<TaggedNostrEvent> = [];
q.feed.on("event", evs => {
q.on("event", evs => {
if (!t) {
tBuf = [...evs];
t = setTimeout(() => {
@ -41,9 +41,8 @@ export function useRefreshFeedCache<T>(c: RefreshFeedCache<T>, leaveOpen = false
});
q.uncancel();
return () => {
q.feed.off("event");
q.off("event");
q.cancel();
q.sendClose();
};
}
}, [sub]);