fix: update selected_output field to handle which outputs is displayed first (#8538)
* fix: update selected_output field in various starter project JSON files
- Added or adjusted the "selected_output" field in multiple starter project JSON files to ensure consistency and correct functionality.
- Refactored the output selection logic in the GenericNode component to utilize the updated "selected_output" property.
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
* fix: enhance output handling in GenericNode and NodeOutputField components
- Added a check to prevent auto-unhiding outputs with group_outputs set to false in NodeOutputField.
- Updated the GenericNode component to ensure the selected_output field is correctly assigned during node updates.
- Introduced group_outputs property in the OutputFieldType to support new output handling logic.
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
* Revert starter_projects directory to main branch state
* 📝 (general-bugs-shard-3909.spec.ts): update test description to match the changed button text for better clarity and maintainability
---------
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: cristhianzl <cristhian.lousa@gmail.com>
This commit is contained in:
parent
a62902ca92
commit
c18330d449
4 changed files with 17 additions and 3 deletions
|
|
@ -216,10 +216,19 @@ function NodeOutputField({
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (disabledOutput && hidden) {
|
const outputHasGroupOutputsFalse =
|
||||||
|
data.node?.outputs?.[index]?.group_outputs === false;
|
||||||
|
|
||||||
|
if (disabledOutput && hidden && !outputHasGroupOutputsFalse) {
|
||||||
handleUpdateOutputHide(false);
|
handleUpdateOutputHide(false);
|
||||||
}
|
}
|
||||||
}, [disabledOutput, handleUpdateOutputHide, hidden]);
|
}, [
|
||||||
|
disabledOutput,
|
||||||
|
handleUpdateOutputHide,
|
||||||
|
hidden,
|
||||||
|
data.node?.outputs,
|
||||||
|
index,
|
||||||
|
]);
|
||||||
|
|
||||||
const [openOutputModal, setOpenOutputModal] = useState(false);
|
const [openOutputModal, setOpenOutputModal] = useState(false);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -313,7 +313,11 @@ function GenericNode({
|
||||||
newNode.data.node.outputs[outputIndex].selected =
|
newNode.data.node.outputs[outputIndex].selected =
|
||||||
output.selected ?? defaultType;
|
output.selected ?? defaultType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const selectedOutput = newNode.data.node.outputs[outputIndex]?.name;
|
||||||
|
(newNode.data as NodeDataType).selected_output = selectedOutput;
|
||||||
}
|
}
|
||||||
|
|
||||||
return newNode;
|
return newNode;
|
||||||
});
|
});
|
||||||
updateNodeInternals(data.id);
|
updateNodeInternals(data.id);
|
||||||
|
|
|
||||||
|
|
@ -104,6 +104,7 @@ export type OutputFieldType = {
|
||||||
types: Array<string>;
|
types: Array<string>;
|
||||||
selected?: string;
|
selected?: string;
|
||||||
name: string;
|
name: string;
|
||||||
|
group_outputs?: boolean;
|
||||||
method?: string;
|
method?: string;
|
||||||
display_name: string;
|
display_name: string;
|
||||||
hidden?: boolean;
|
hidden?: boolean;
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ test(
|
||||||
await expect(page.getByTestId("button_run_chat output")).toBeVisible({
|
await expect(page.getByTestId("button_run_chat output")).toBeVisible({
|
||||||
timeout: 30000,
|
timeout: 30000,
|
||||||
});
|
});
|
||||||
await expect(page.getByTestId("button_run_openai")).toBeVisible({
|
await expect(page.getByTestId("button_run_language model")).toBeVisible({
|
||||||
timeout: 30000,
|
timeout: 30000,
|
||||||
});
|
});
|
||||||
await expect(page.getByTestId("button_run_prompt")).toBeVisible({
|
await expect(page.getByTestId("button_run_prompt")).toBeVisible({
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue