@umituz/react-native-ai-generation-content 1.22.8 → 1.22.9
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.22.
|
|
3
|
+
"version": "1.22.9",
|
|
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",
|
|
@@ -9,7 +9,7 @@ import { useAppDesignTokens } from "@umituz/react-native-design-system";
|
|
|
9
9
|
import { useFlow, resetFlowStore } from "../../../../infrastructure/flow";
|
|
10
10
|
import { StepType } from "../../../../domain/entities/flow-config.types";
|
|
11
11
|
import type { StepDefinition } from "../../../../domain/entities/flow-config.types";
|
|
12
|
-
import type { CoupleFutureWizardProps
|
|
12
|
+
import type { CoupleFutureWizardProps } from "../../domain/wizard.types";
|
|
13
13
|
import { PartnerStepScreen } from "../../../partner-upload";
|
|
14
14
|
import { ScenarioPreviewScreen } from "../../../scenarios";
|
|
15
15
|
import { GeneratingStepContent } from "./GeneratingStepContent";
|
|
@@ -48,15 +48,6 @@ export const CoupleFutureWizard: React.FC<CoupleFutureWizardProps> = ({
|
|
|
48
48
|
initialStepIndex,
|
|
49
49
|
});
|
|
50
50
|
|
|
51
|
-
const handleScenarioSelect = useCallback(
|
|
52
|
-
(scenario: WizardScenarioData) => {
|
|
53
|
-
flow.setCategory(scenario);
|
|
54
|
-
callbacks?.onScenarioSelect?.(scenario);
|
|
55
|
-
flow.nextStep();
|
|
56
|
-
},
|
|
57
|
-
[flow, callbacks],
|
|
58
|
-
);
|
|
59
|
-
|
|
60
51
|
const handleScenarioPreviewContinue = useCallback(() => {
|
|
61
52
|
// No auth check needed here - just proceed to photo upload
|
|
62
53
|
flow.nextStep();
|
|
@@ -29,7 +29,24 @@ let flowStoreInstance: FlowStoreType | null = null;
|
|
|
29
29
|
|
|
30
30
|
export const useFlow = (config: UseFlowConfig): UseFlowReturn => {
|
|
31
31
|
const storeRef = useRef<FlowStoreType | null>(null);
|
|
32
|
+
const prevConfigRef = useRef<{ initialStepIndex?: number; initialStepId?: string } | undefined>(undefined);
|
|
32
33
|
|
|
34
|
+
// Detect config changes (initialStepIndex or initialStepId changed)
|
|
35
|
+
const configChanged =
|
|
36
|
+
prevConfigRef.current !== undefined &&
|
|
37
|
+
(prevConfigRef.current.initialStepIndex !== config.initialStepIndex ||
|
|
38
|
+
prevConfigRef.current.initialStepId !== config.initialStepId);
|
|
39
|
+
|
|
40
|
+
// If config changed, reset and recreate store
|
|
41
|
+
if (configChanged) {
|
|
42
|
+
if (flowStoreInstance) {
|
|
43
|
+
flowStoreInstance.getState().reset();
|
|
44
|
+
}
|
|
45
|
+
flowStoreInstance = null;
|
|
46
|
+
storeRef.current = null;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Initialize store if needed
|
|
33
50
|
if (!storeRef.current) {
|
|
34
51
|
if (!flowStoreInstance) {
|
|
35
52
|
flowStoreInstance = createFlowStore({
|
|
@@ -41,6 +58,12 @@ export const useFlow = (config: UseFlowConfig): UseFlowReturn => {
|
|
|
41
58
|
storeRef.current = flowStoreInstance;
|
|
42
59
|
}
|
|
43
60
|
|
|
61
|
+
// Store current config for next render comparison
|
|
62
|
+
prevConfigRef.current = {
|
|
63
|
+
initialStepIndex: config.initialStepIndex,
|
|
64
|
+
initialStepId: config.initialStepId,
|
|
65
|
+
};
|
|
66
|
+
|
|
44
67
|
const store = storeRef.current;
|
|
45
68
|
const state = store();
|
|
46
69
|
const totalSteps = config.steps.length;
|