mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-25 20:45:19 +00:00
Notes counter: unsubscribe without clearing count on resubscribe\n\n- Avoid calling cancel() in subscribe; just unsubscribe old sub to prevent wiping count to 0.\n- Prevents green→grey flicker after closing sheet or location updates.
This commit is contained in:
@@ -16,10 +16,10 @@ final class LocationNotesCounter: ObservableObject {
|
|||||||
|
|
||||||
func subscribe(geohash gh: String) {
|
func subscribe(geohash gh: String) {
|
||||||
let norm = gh.lowercased()
|
let norm = gh.lowercased()
|
||||||
if geohash == norm { return }
|
if geohash == norm, subscriptionID != nil { return }
|
||||||
// Do not clear count immediately to avoid UI flicker; keep last known
|
// Unsubscribe previous without clearing count to avoid flicker
|
||||||
// value until initial load completes on the new subscription.
|
if let sub = subscriptionID { NostrRelayManager.shared.unsubscribe(id: sub) }
|
||||||
cancel()
|
subscriptionID = nil
|
||||||
geohash = norm
|
geohash = norm
|
||||||
noteIDs.removeAll()
|
noteIDs.removeAll()
|
||||||
initialLoadComplete = false
|
initialLoadComplete = false
|
||||||
|
|||||||
Reference in New Issue
Block a user