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

@ -30,21 +30,20 @@ System.on("event", (_, ev) => {
socialGraphInstance.handleEvent(ev);
});
System.profileCache.on("change", keys => {
const changed = removeUndefined(keys.map(a => System.profileCache.getFromCache(a)));
changed.forEach(addCachedMetadataToFuzzySearch);
});
/**
* Add profile loader fn
*/
if (CONFIG.httpCache) {
System.ProfileLoader.loaderFn = async (keys: Array<string>) => {
System.profileLoader.loaderFn = async (keys: Array<string>) => {
return removeUndefined(await Promise.all(keys.map(a => fetchProfile(a))));
};
}
setTimeout(() => {
System.UserProfileCache.snapshot().forEach(a => {
addCachedMetadataToFuzzySearch(a);
});
}, 2000);
export async function fetchProfile(key: string) {
try {
throwIfOffline();