@umituz/react-native-ai-generation-content 1.82.7 → 1.82.8

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-ai-generation-content",
3
- "version": "1.82.7",
3
+ "version": "1.82.8",
4
4
  "description": "Provider-agnostic AI generation orchestration for React Native with result preview components",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -53,7 +53,12 @@ export const executeWizardGeneration = async (params: ExecuteGenerationParams):
53
53
  await generationFn(input, prompt);
54
54
 
55
55
  if (isMountedRef.current) {
56
- dispatch({ type: "COMPLETE" });
56
+ // For video queue mode, don't dispatch COMPLETE — the queue polling handles
57
+ // completion separately via onSuccess. The function above just submitted to queue.
58
+ // For photo (blocking) mode, the generation is truly done here.
59
+ if (!isVideoMode) {
60
+ dispatch({ type: "COMPLETE" });
61
+ }
57
62
  }
58
63
  } catch (error: unknown) {
59
64
  if (!isMountedRef.current) return;
@@ -136,6 +136,7 @@ export const useGenerationOrchestrator = <TInput, TResult>(
136
136
  // Create new AbortController for this generation
137
137
  abortControllerRef.current = new AbortController();
138
138
  isGeneratingRef.current = true;
139
+ let moderationPending = false;
139
140
  setState({ ...INITIAL_STATE, status: "checking", isGenerating: true });
140
141
 
141
142
  if (typeof __DEV__ !== "undefined" && __DEV__) {
@@ -167,7 +168,7 @@ export const useGenerationOrchestrator = <TInput, TResult>(
167
168
  console.log("[Orchestrator] Starting moderation check");
168
169
  }
169
170
 
170
- return await handleModeration({
171
+ const result = await handleModeration({
171
172
  input,
172
173
  moderation,
173
174
  alertMessages,
@@ -180,6 +181,14 @@ export const useGenerationOrchestrator = <TInput, TResult>(
180
181
  onError,
181
182
  handleLifecycleComplete,
182
183
  });
184
+
185
+ // If handleModeration returned undefined, the warning dialog was shown.
186
+ // The dialog's proceed/cancel callbacks now own isGeneratingRef — don't reset in finally.
187
+ if (result === undefined && moderation) {
188
+ moderationPending = true;
189
+ }
190
+
191
+ return result;
183
192
  } catch (err) {
184
193
  // Don't show error if aborted
185
194
  if (abortControllerRef.current?.signal.aborted) {
@@ -197,7 +206,10 @@ export const useGenerationOrchestrator = <TInput, TResult>(
197
206
  handleLifecycleComplete("error", undefined, error);
198
207
  throw error;
199
208
  } finally {
200
- isGeneratingRef.current = false;
209
+ // Only reset if moderation dialog did not take ownership
210
+ if (!moderationPending) {
211
+ isGeneratingRef.current = false;
212
+ }
201
213
  abortControllerRef.current = null;
202
214
  }
203
215
  },