@umituz/react-native-subscription 2.37.12 → 2.37.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-subscription",
3
- "version": "2.37.12",
3
+ "version": "2.37.13",
4
4
  "description": "Complete subscription management with RevenueCat, paywall UI, and credits system for React Native apps",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -43,6 +43,15 @@ class UserSwitchMutexImpl {
43
43
  }
44
44
  await new Promise<void>(resolve => setTimeout(() => resolve(), delayNeeded));
45
45
  }
46
+
47
+ // Re-check after delay: another caller may have acquired the lock during our wait
48
+ if (this.activeSwitchPromise) {
49
+ if (this.activeUserId === userId) {
50
+ return { shouldProceed: false, existingPromise: this.activeSwitchPromise };
51
+ }
52
+ // Another switch started for a different user — recurse to wait again
53
+ return this.acquire(userId);
54
+ }
46
55
  }
47
56
 
48
57
  this.activeUserId = userId;