subos-frontend 1.0.106 → 1.0.108

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/dist/index.js CHANGED
@@ -414,12 +414,14 @@ var SubscriptionProvider = ({ children }) => {
414
414
  const [subscription, setSubscription] = React11.useState(null);
415
415
  const [loading, setLoading] = React11.useState(false);
416
416
  const [error, setError] = React11.useState(null);
417
+ const loadingRef = React11.useRef(false);
417
418
  const fetchSubscription = React11.useCallback(async (externalId) => {
418
419
  if (!externalId || externalId === "undefined" || externalId.trim() === "") {
419
420
  setError("Invalid user ID. Please ensure you are properly authenticated.");
420
421
  return;
421
422
  }
422
- if (loading) return;
423
+ if (loadingRef.current) return;
424
+ loadingRef.current = true;
423
425
  setLoading(true);
424
426
  setError(null);
425
427
  try {
@@ -435,9 +437,10 @@ var SubscriptionProvider = ({ children }) => {
435
437
  setError("Failed to load subscription information. Please try again later.");
436
438
  }
437
439
  } finally {
440
+ loadingRef.current = false;
438
441
  setLoading(false);
439
442
  }
440
- }, [loading, currency]);
443
+ }, [currency]);
441
444
  const clearSubscription = React11.useCallback(() => {
442
445
  setSubscription(null);
443
446
  setError(null);