-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…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
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
…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
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
lucaseduoli
approved these changes
Nov 22, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!!
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
src/frontend/src/controllers/API/queries/flows/use-patch-update-flow.ts
: Exported theIPatchUpdateFlow
interface to make it accessible in other parts of the application.src/frontend/src/modals/codeAreaModal/hooks/use-update-node-code.tsx
: Created a new hookuseFlowUpdate
to handle updating nodes within a flow. This hook uses theIPatchUpdateFlow
interface and integrates with thepatchUpdateFlow
mutation.Component Modifications:
src/frontend/src/modals/codeAreaModal/index.tsx
:useFlowUpdate
and theusePatchUpdateFlow
mutation. [1] [2]componentId
to theCodeAreaModal
component.updateNodeInFlow
function from theuseFlowUpdate
hook to update the node data when the code is validated. [1] [2]src/frontend/src/pages/FlowPage/components/nodeToolbarComponent/index.tsx
: Passed thecomponentId
prop to theCodeAreaModal
component.Type Definitions:
src/frontend/src/types/components/index.ts
: Added thecomponentId
property to thecodeAreaModalPropsType
type definition to support the new functionality.