Skip to content

Commit

Permalink
fix: fix connector definition not correctly update after user picking…
Browse files Browse the repository at this point in the history
… up the existing connector (#935)

Because

- We have a nested flow, 
  - user select connector definition
  - user select existing connector
  - We didn't put in the updated connector definition
- close https://github.com/instill-ai/community/issues/549

This commit

- fix connector definition not correctly update after user picking up
the existing connector
  • Loading branch information
EiffelFly committed Feb 5, 2024
1 parent 56e9d11 commit 08ef854
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export function pickComponentsFromReferenceHints(
nonObjectArrayHints.forEach((hint) => {
fields.push(
<ComponentOutputReferenceHints.ListField
key={hint.path}
title={hint.title}
path={hint.path}
instillFormat={hint.instillFormat}
Expand All @@ -46,6 +47,7 @@ export function pickComponentsFromReferenceHints(
Object.entries(groupedObjectArrayHints).forEach(([parentPath, hints]) => {
fields.push(
<ComponentOutputReferenceHints.ObjectArrayField
key={parentPath}
parentPath={parentPath}
hints={hints}
componentID={componentID}
Expand All @@ -58,6 +60,7 @@ export function pickComponentsFromReferenceHints(
Object.entries(groupedHints).forEach(([instillFormat, hints]) => {
fields.push(
<ComponentOutputReferenceHints.GroupByFormatField
key={instillFormat}
instillFormat={instillFormat}
hints={hints}
componentID={componentID}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ export function pickRegularFieldsFromInstillFormTree(
if (enableSmartHint) {
return (
<SmartHintFields.TextField
key={tree.path}
fieldKey={tree.fieldKey}
path={tree.path}
form={form}
Expand Down
2 changes: 2 additions & 0 deletions packages/toolkit/src/view/pipeline-builder/FlowControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,8 @@ export const FlowControl = (props: FlowControlProps) => {
throw new Error("Component type is not defined");
}

console.log(resource);

if ("configuration" in resource) {
// Create a new array to let reactflow rerender the component
newNodes = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,11 @@ export const ConnectorNode = ({ data, id }: NodeProps<ConnectorNodeData>) => {
component: {
...node.data.component,
resource_name: connector.name,

// Some dynamic generated connector definition like instill_model's modelName enum
// will only be returned from connectors endpoint. Therefore, we need to update the
// connector definition here
connector_definition: connector.connector_definition,
},
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const UserDefinedFieldItem = ({
<div className="my-auto flex flex-row gap-x-2">
<Tooltip.Provider>
<Tooltip.Root>
<Tooltip.Trigger>
<Tooltip.Trigger asChild>
<button onClick={() => onEditField(fieldKey)}>
<Icons.Edit03 className="my-auto h-3 w-3 stroke-semantic-accent-on-bg" />
</button>
Expand Down Expand Up @@ -63,7 +63,7 @@ export const UserDefinedFieldItem = ({
</Tooltip.Provider>
<Tooltip.Provider>
<Tooltip.Root>
<Tooltip.Trigger>
<Tooltip.Trigger asChild>
<button onClick={() => onDeleteField(fieldKey)}>
<Icons.Trash01 className="h-3 w-3 stroke-semantic-error-on-bg" />
</button>
Expand Down

0 comments on commit 08ef854

Please sign in to comment.