mirror of
https://github.com/soconnor0919/hristudio.git
synced 2026-03-23 19:27:51 -04:00
Add debug logging for branching flow
This commit is contained in:
@@ -579,11 +579,14 @@ export const WizardInterface = React.memo(function WizardInterface({
|
||||
};
|
||||
|
||||
const handleNextStep = (targetIndex?: number) => {
|
||||
console.log(`[DEBUG] handleNextStep called: targetIndex=${targetIndex}, currentStepIndex=${currentStepIndex}`);
|
||||
console.log(`[DEBUG] Steps: ${steps.map((s, i) => `${i}:${s.name}`).join(' | ')}`);
|
||||
|
||||
// If explicit target provided (from branching choice), use it
|
||||
if (typeof targetIndex === "number") {
|
||||
// Find step by index to ensure safety
|
||||
if (targetIndex >= 0 && targetIndex < steps.length) {
|
||||
console.log(`[WizardInterface] Manual jump to step ${targetIndex}`);
|
||||
console.log(`[WizardInterface] Manual jump to step ${targetIndex} (${steps[targetIndex]?.name})`);
|
||||
|
||||
// Log manual jump
|
||||
logEventMutation.mutate({
|
||||
@@ -609,6 +612,8 @@ export const WizardInterface = React.memo(function WizardInterface({
|
||||
return next;
|
||||
});
|
||||
return;
|
||||
} else {
|
||||
console.warn(`[DEBUG] Invalid targetIndex: ${targetIndex}, steps.length=${steps.length}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -863,13 +868,21 @@ export const WizardInterface = React.memo(function WizardInterface({
|
||||
if (parameters.nextStepId) {
|
||||
const nextId = String(parameters.nextStepId);
|
||||
const targetIndex = steps.findIndex((s) => s.id === nextId);
|
||||
console.log(`[DEBUG] Branch choice: value=${parameters.value}, label=${parameters.label}`);
|
||||
console.log(`[DEBUG] Target step ID: ${nextId}`);
|
||||
console.log(`[DEBUG] Target index in steps array: ${targetIndex}`);
|
||||
console.log(`[DEBUG] Available step IDs: ${steps.map(s => s.id).join(', ')}`);
|
||||
if (targetIndex !== -1) {
|
||||
console.log(
|
||||
`[WizardInterface] Choice-based jump to step ${targetIndex} (${nextId})`,
|
||||
);
|
||||
handleNextStep(targetIndex);
|
||||
return; // Exit after jump
|
||||
} else {
|
||||
console.warn(`[DEBUG] Target step not found! nextStepId=${nextId}`);
|
||||
}
|
||||
} else {
|
||||
console.warn(`[DEBUG] No nextStepId in parameters!`, parameters);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -535,6 +535,7 @@ export function WizardActionItem({
|
||||
className="hover:border-primary hover:bg-primary/5 h-auto justify-start px-4 py-3 text-left"
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
console.log(`[DEBUG WizardActionItem] Choice clicked: actionId=${action.id}, value=${value}, label=${label}, nextStepId=${nextStepId}`);
|
||||
onExecute(action.id, { value, label, nextStepId });
|
||||
// Don't call onCompleted() here - the branching logic in handleWizardResponse
|
||||
// will handle the jump and reset completedActionsCount
|
||||
|
||||
Reference in New Issue
Block a user