Attempt to avoid stomping follows by refreshing before updating

This commit is contained in:
Jonathan Staab 2023-01-02 05:48:11 -08:00
parent 72a511c846
commit 28ecf8f485
3 changed files with 14 additions and 10 deletions

View File

@ -28,8 +28,6 @@ If you like Coracle and want to support its development, you can donate sats via
# Bugs
- [ ] Reload user details when loading on visiting a user's page for the first time
- [ ] Fix nuking follow list on multiple devices. Aggressive refresh? Dufflepud caching?
- [ ] Follow fiatjaf's vision of clients being smart and connecting to recommended relays to fetch content
- [ ] Add alerts for replies to posts the user liked
- [ ] Stack views so scroll position isn't lost on navigation

View File

@ -186,12 +186,12 @@ const listenForEvents = async (key, filter, onEvent, {shouldProcess = true} = {}
listenForEvents.subs = {}
const loadPeople = (pubkeys, opts = {}) => {
const loadPeople = (pubkeys, {kinds = [0, 3, 12165], ...opts} = {}) => {
if (pubkeys.length === 0) {
return []
}
return loadEvents({kinds: [0, 3, 12165], authors: pubkeys}, opts)
return loadEvents({kinds, authors: pubkeys}, opts)
}
const syncNetwork = async () => {

View File

@ -54,16 +54,22 @@
const setActiveTab = tab => navigate(`/people/${pubkey}/${tab}`)
const follow = () => {
relay.cmd.addPetname($user, pubkey, person.name)
const follow = async () => {
following = true
// Make sure our follow list is up to date
await relay.pool.loadPeople([$user.pubkey], {kinds: [3]})
relay.cmd.addPetname($user, pubkey, person.name)
}
const unfollow = () => {
relay.cmd.removePetname($user, pubkey)
const unfollow = async () => {
following = false
// Make sure our follow list is up to date
await relay.pool.loadPeople([$user.pubkey], {kinds: [3]})
relay.cmd.removePetname($user, pubkey)
}
const openAdvanced = () => {