Damus
Frederik Handberg · 4d
I'm getting a leak somewhere in my formatting notifications (I use `NotificationCenter`). This is causing problems if I have two note documents open in the same window. For example, if I change the ...
Frederik Handberg profile picture
Think I have found the issue.

It's most likely the way I use `removeObserver`. I need to pass the observer token to `removeObserver` to make sure the correct observers are actually removed. This means I need an array to keep track of the many tokens from all the different formatting notifications.
1
Frederik Handberg · 4d
The token strategy did not make much of a difference, but replacing `.onAppear` and `.onDisappear` with `.onReceive` worked. I also decided to use `MergeMany` instead of having one `.onReceive` for each notification (there are many). https://developer.apple.com/documentation/combine/publishers/merg...