What is Nostr?
prs / Damus PRs
npub1ahc…7v97
2023-06-17 12:31:03

prs on Nostr: simplify and fix issues with RelayStatus (#1296) While attempting to debug the recent ...

simplify and fix issues with RelayStatus (#1296)

While attempting to debug the recent relay connection issues, I noticed some problems and improvement opportunities with `RelayStatus`.

This PR addresses these issues:
1. The console message "No image named 'network' found in asset catalog..." prints for every occurrence of `RelayStatus`, presumably because that image was removed with the iconography update.
2. The property `connecting` never gets set to false after being set to true, so you have to leave the view and come back for it to update. Otherwise it will always appear to be connecting even after it has reconnected.
3. The view uses a timer for polling the connection status every 2 seconds. This PR updates that to make `RelayConnection` observable.
4. `RelayStatus` was being passed the entire `RelayPool` when all it needs is a `RelayConnection` to track.

Lastly, in a separate commit, I changed the name of `RelayStatus` to `RelayStatusView`. IMO it makes code easier to read and maintain when view names end with the word "view".

relay-status, 3 commits

https://github.com/damus-io/damus/pull/1296
Author Public Key
npub1ahckk8wkr64n2w5r4arsesf42upfhlmgy76vhxmlex7mvv4zhrnqry7v97