Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Implement useFlowUpdate hook and refactor node code management #4783

Merged
merged 5 commits into from
Nov 22, 2024

Conversation

Cristhianzl
Copy link
Member

This pull request introduces several changes to the frontend codebase, primarily focusing on updating the flow management and integrating a new hook for updating node code. The key changes involve exporting interfaces, creating a new hook, and modifying the CodeAreaModal component to utilize the new hook.

Key Changes:

Interfaces and Hooks:

Component Modifications:

  • src/frontend/src/modals/codeAreaModal/index.tsx:

    • Imported the new hook useFlowUpdate and the usePatchUpdateFlow mutation. [1] [2]
    • Added a new prop componentId to the CodeAreaModal component.
    • Integrated the updateNodeInFlow function from the useFlowUpdate hook to update the node data when the code is validated. [1] [2]
  • src/frontend/src/pages/FlowPage/components/nodeToolbarComponent/index.tsx: Passed the componentId prop to the CodeAreaModal component.

Type Definitions:

…xternal use

✨ (use-update-node-code.tsx): add useFlowUpdate hook to update node in flow based on componentId and data
🔧 (index.tsx): import usePatchUpdateFlow and useFlowUpdate hooks, update node in flow when code is updated in CodeAreaModal
🔧 (index.tsx): pass componentId to CodeAreaModal to update node in flow based on componentId
🔧 (index.ts): add componentId prop to codeAreaModalPropsType for CodeAreaModal component
🔧 (index.ts): add componentId prop to codeAreaModalPropsType for CodeAreaModal component
@Cristhianzl Cristhianzl self-assigned this Nov 22, 2024
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. javascript Pull requests that update Javascript code labels Nov 22, 2024
@github-actions github-actions bot added the bug Something isn't working label Nov 22, 2024
…node code in a flow

🔧 (index.tsx): Remove unused import and function related to updating node code in a flow, refactor code to directly update node data in the nodes array instead of using a separate function.
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Nov 22, 2024
…IPatchUpdateFlow interface to follow module structure conventions
…tchUpdateFlow' to clean up code and improve maintainability
Copy link
Collaborator

@lucaseduoli lucaseduoli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!!

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Nov 22, 2024
@ogabrielluiz ogabrielluiz merged commit b3181ce into main Nov 22, 2024
24 of 25 checks passed
@ogabrielluiz ogabrielluiz deleted the cz/fix-code-not-updating branch November 22, 2024 21:19
diogocabral pushed a commit to headlinevc/langflow that referenced this pull request Nov 26, 2024
…angflow-ai#4783)

* 📝 (use-patch-update-flow.ts): export IPatchUpdateFlow interface for external use
✨ (use-update-node-code.tsx): add useFlowUpdate hook to update node in flow based on componentId and data
🔧 (index.tsx): import usePatchUpdateFlow and useFlowUpdate hooks, update node in flow when code is updated in CodeAreaModal
🔧 (index.tsx): pass componentId to CodeAreaModal to update node in flow based on componentId
🔧 (index.ts): add componentId prop to codeAreaModalPropsType for CodeAreaModal component
🔧 (index.ts): add componentId prop to codeAreaModalPropsType for CodeAreaModal component

* 🔧 (use-update-node-code.tsx): Remove unused code related to updating node code in a flow
🔧 (index.tsx): Remove unused import and function related to updating node code in a flow, refactor code to directly update node data in the nodes array instead of using a separate function.

* 📝 (use-patch-update-flow.ts): remove unnecessary export keyword from IPatchUpdateFlow interface to follow module structure conventions

* 📝 (codeAreaModal/index.tsx): remove unused import and variable 'usePatchUpdateFlow' to clean up code and improve maintainability
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working javascript Pull requests that update Javascript code lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants