File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
WooCommerce/Classes/System Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -85,10 +85,10 @@ final class SessionManager: SessionManagerProtocol {
8585 }
8686 }
8787 set {
88- credentialsQueue. sync {
88+ let shouldUpdateWatchSync = credentialsQueue. sync { ( ) -> Bool in
8989 let currentCredentials = loadCredentials ( )
9090 guard newValue != currentCredentials else {
91- return
91+ return false
9292 }
9393
9494 removeCredentials ( )
@@ -97,6 +97,12 @@ final class SessionManager: SessionManagerProtocol {
9797 saveCredentials ( credentials)
9898 }
9999
100+ return true
101+ }
102+
103+ // Update watch synchronizer outside the sync block to avoid potential deadlocks
104+ // from @Published property triggering Combine subscribers that might read credentials
105+ if shouldUpdateWatchSync {
100106 watchDependenciesSynchronizer. credentials = newValue
101107 }
102108 }
You can’t perform that action at this time.
0 commit comments