Skip to content

Commit

Permalink
fix(pipeline-builder): fix task description not react to the selected…
Browse files Browse the repository at this point in the history
… task (#944)

Because

- task description not react to the selected task

This commit

- fix task description not react to the selected task
  • Loading branch information
EiffelFly committed Feb 7, 2024
1 parent 2680f70 commit 7e600f8
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,27 +117,45 @@ export function pickRegularFieldsFromInstillFormTree(

// We will use the const path as the OneOfConditionField's path

const constField = tree.conditions[
const defaultConstField = tree.conditions[
Object.keys(tree.conditions)[0]
].properties.find((e) => "const" in e);

if (!constField?.path) {
if (!defaultConstField?.path) {
return null;
}

const selectedCondition = selectedConditionMap?.[defaultConstField?.path];

let selectedConstField: InstillFormTree | undefined;

if (selectedCondition) {
selectedConstField = tree.conditions[selectedCondition].properties.find(
(e) => "const" in e
);
}

return (
<RegularFields.OneOfConditionField
form={form}
path={constField.path}
path={defaultConstField.path}
tree={tree}
selectedConditionMap={selectedConditionMap}
setSelectedConditionMap={setSelectedConditionMap}
key={constField.path}
key={defaultConstField.path}
conditionComponentsMap={conditionComponents}
title={title}
shortDescription={tree.instillShortDescription}
shortDescription={
selectedConstField
? selectedConstField.instillShortDescription
: defaultConstField.instillShortDescription
}
disabled={disabledAll}
description={tree.description ?? null}
description={
selectedConstField
? selectedConstField.description ?? null
: defaultConstField.description ?? null
}
size={size}
isHidden={tree.isHidden}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ export function useComponentOutputFields(props: UseComponentOutputFieldsProps) {

const outputFormTree = transformInstillJSONSchemaToFormTree(props.schema);

console.log(outputFormTree);

const fields = pickComponentOutputFieldsFromInstillFormTree({
...props,
tree: outputFormTree,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ export function useUpdaterOnRightPanel({
}

timer.current = setTimeout(() => {
console.log("update");
const newNodes = nodes.map((node) => {
if (
nodeType === "connector" &&
Expand Down

0 comments on commit 7e600f8

Please sign in to comment.