Replying to Avatar jb55

nostr:npub1qlk0nqupxmlyxravg0aqscxmcc4q4tq898z6x003rykwwh3npj0syvyayc nice! Some comments:

> diff --git a/damus/Views/Relays/RelayDetailView.swift b/damus/Views/Relays/RelayDetailView.swift

> index c53bc123..7606799d 100644

> --- a/damus/Views/Relays/RelayDetailView.swift

> +++ b/damus/Views/Relays/RelayDetailView.swift

> @@ -12,8 +12,18 @@ struct RelayDetailView: View {

> let relay: String

> let nip11: RelayMetadata

>

> + @StateObject var log: RelayLog

I'm not sure this will work as a StateObject. When the view disappears,

RelayLog will get deallocated and the writeToDisk callbacks will be

deallocated as well.

Ideally we would create a RelayModel that would replace the

RelayMetadata in RelayMetadatas. Then the RelayModel would contain

RelayMetadata, RelayLog, etc. Composing multiple ObservableObjects into

one is a bit annoying so perhaps we can move some of the publisher stuff

into the RelayModel instead.

Made the requested changes to this PR. A new object called RelayModel now owns the log and the RelayMetadata. The log is now an ObservedObject of the view rather than a StateObject.

Reply to this note

Please Login to reply.

Discussion

Perfect! Will review again soon