lisichatbot 2.2.2 → 2.2.3
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 +1 -1
- package/src/index.js +12 -0
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -2709,6 +2709,18 @@ async function handleNext() {
|
|
|
2709
2709
|
}
|
|
2710
2710
|
|
|
2711
2711
|
if (shouldShow) {
|
|
2712
|
+
// Remove stale selections that no longer exist in the new options
|
|
2713
|
+
const dependentField = nextStepConfig?.input?.field;
|
|
2714
|
+
if (dependentField && chatState.data[dependentField] !== undefined) {
|
|
2715
|
+
const validOptions = (nextStepConfig.input?.options || []).map(o => o.value);
|
|
2716
|
+
const currentValue = chatState.data[dependentField];
|
|
2717
|
+
if (Array.isArray(currentValue)) {
|
|
2718
|
+
const filtered = currentValue.filter(v => validOptions.includes(v));
|
|
2719
|
+
chatState.data[dependentField] = filtered.length > 0 ? filtered : undefined;
|
|
2720
|
+
} else if (!validOptions.includes(currentValue)) {
|
|
2721
|
+
delete chatState.data[dependentField];
|
|
2722
|
+
}
|
|
2723
|
+
}
|
|
2712
2724
|
// Show this dependent step, keep returnToStep for later
|
|
2713
2725
|
// console.log(` ✅ Step ${nextStep} should be shown - continuing to it (returnToStep=${targetStep} preserved)`);
|
|
2714
2726
|
chatState.step = nextStep;
|