@umituz/react-native-subscription 2.2.1 → 2.2.2

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.2.1",
3
+ "version": "2.2.2",
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",
@@ -125,7 +125,12 @@ export const useInitializeCredits = ({
125
125
  },
126
126
  onSuccess: (result) => {
127
127
  if (userId && result.success && result.data) {
128
+ // Set the data immediately for optimistic UI
128
129
  queryClient.setQueryData(creditsQueryKeys.user(userId), result.data);
130
+ // Also invalidate to ensure all subscribers get the update
131
+ queryClient.invalidateQueries({
132
+ queryKey: creditsQueryKeys.user(userId),
133
+ });
129
134
  }
130
135
  },
131
136
  });