File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' gungi.js ' : patch
3
+ ---
4
+
5
+ 🔧 prevent duplicate piece IDs in state transitions
6
+
7
+ Addresses race conditions in rapid ` load() ` calls where same piece
8
+ type/color could receive identical IDs, breaking game state integrity.
9
+
10
+ - ` applyCanonicalToMissingIds ` used flawed conflict detection
11
+ - Arata moves assigned same ID to both board and hand pieces
12
+ - Race conditions during rapid state transitions
13
+
14
+ Fixed core ID assignment logic with ` Set ` -based conflict tracking
15
+ rather than real-time array scanning. Balanced two requirements:
16
+
17
+ ** Stability** : Preserve IDs across close FEN states (critical for UX)
18
+ ** Uniqueness** : Ensure no duplicate IDs ever persist in system
19
+
20
+ - ` ensureUniqueIdsLenient() ` : Minimal fixes, preserves stability
21
+ - ` ensureUniqueIds() ` : Complete reassignment for canonical states
22
+ - ` checkForDuplicateIds() ` : Detection without modification
23
+
24
+ Arata moves now maintain hand piece ID stability while giving
25
+ board pieces new IDs, eliminating the duplicate scenario without
26
+ breaking expected behavior.
You can’t perform that action at this time.
0 commit comments