Delay call to fetch profile contacts

This commit is contained in:
Bojan Mojsilovic 2023-07-20 11:42:32 +02:00
parent 1b3c057fcf
commit 62c9f4d114
2 changed files with 3 additions and 22 deletions

View File

@ -267,8 +267,10 @@ export const ProfileProvider = (props: { children: ContextChildren }) => {
updateStore('userProfile', () => undefined);
updateStore('userStats', () => ({ ...emptyStats }));
getUserProfileInfo(profileKey, `profile_info_${APP_ID}`);
getProfileContactList(profileKey, `profile_contacts_${APP_ID}`);
getProfileScoredNotes(profileKey, `profile_scored_${APP_ID}`, 10);
setTimeout(() => {
getProfileContactList(profileKey, `profile_contacts_${APP_ID}`);
}, 100);
}
}

View File

@ -75,32 +75,11 @@ const Profile: Component = () => {
}
const setProfile = (hex: string | undefined) => {
// if (hex === profile?.profileKey) {
// return;
// }
profile?.actions.setProfileKey(hex);
profile?.actions.clearNotes();
profile?.actions.fetchNotes(hex);
}
// const react = createReaction(() => {
// setProfile(getHex());
// });
// onMount(() => {
// // If connection doesn't exist at mount time,
// // create a one-time reaction, when connection is established
// // to fetch profile data.
// if (!isConnected()) {
// react(() => isConnected());
// return;
// }
// // Otherwise, fetch profile data.
// setProfile(getHex());
// });
createEffect(() => {
if (account?.isKeyLookupDone) {
setProfile(getHex());