commit f45ecf8db8d937ad9c0e7433253d0c53b9c4c123
parent 92bb8a747986deb88ad5f98c9ff030a7d4b63aab
Author: Michael Camilleri <[email protected]>
Date: Thu, 21 May 2026 06:21:47 +0900
Avoid republishing unchanged roster entries
PlayerRoster now compares the computed participant list before assigning
entries. Remote player selection refreshes can still update cursor state, but
they no longer republish an identical roster and unnecessarily invalidate the
Users menu while a colour submenu is open.
Co-Authored-By: Codex GPT 5.5 <[email protected]>
Diffstat:
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/Crossmate/Models/PlayerRoster.swift b/Crossmate/Models/PlayerRoster.swift
@@ -9,7 +9,7 @@ import Observation
@MainActor
final class PlayerRoster {
- struct Entry: Identifiable {
+ struct Entry: Equatable, Identifiable {
let authorID: String
let name: String
let color: PlayerColor
@@ -253,7 +253,10 @@ final class PlayerRoster {
color: preferences.color,
isLocal: true
)
- entries = [localEntry] + remoteEntries
+ let updatedEntries = [localEntry] + remoteEntries
+ if entries != updatedEntries {
+ entries = updatedEntries
+ }
// Map raw cursor tracks to the resolved colour from the entry list,
// dropping anything stale or with no matching entry.