-
Notifications
You must be signed in to change notification settings - Fork 798
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
Implement 'you have unsaved changes' #850
Conversation
…src/' <!-- ELLIPSIS_HIDDEN --> | 🚀 | This description was created by [Ellipsis](https://www.ellipsis.dev) for commit 8da3912094366ad977e2ae09d2d9d77cb8948eb4 | |--------|--------| feat: add unsaved changes tracking to workflow editor ### Summary: Add unsaved changes tracking to workflow editor with state management and navigation prompt. **Key points**: - Implement unsaved changes tracking in workflow editor. - Use `useWorkflowHasChangesStore` in `FlowRenderer.tsx`, `WorkflowEditor.tsx`, and `WorkflowParametersPanel.tsx`. - Display dialog in `WorkflowEditor.tsx` when navigating away with unsaved changes. - Introduce `WorkflowHasChangesStore.ts` for `hasChanges` state management. - Update `FlowRenderer.tsx` for node and edge modifications. - Update `WorkflowParametersPanel.tsx` for parameter add, edit, and delete. ---- Generated with ❤️ by [ellipsis.dev](https://www.ellipsis.dev) <!-- ELLIPSIS_HIDDEN -->
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.
👍 Looks good to me! Incremental review on c5a8746 in 28 seconds
More details
- Looked at
681
lines of code in4
files - Skipped
0
files when reviewing. - Skipped posting
3
drafted comments based on config settings.
1. skyvern-frontend/src/routes/workflows/editor/FlowRenderer.tsx:430
- Draft comment:
Consider checking ifblocker.proceed
is defined before calling it to prevent potential runtime errors. - Reason this comment was not posted:
Confidence changes required:50%
TheuseBlocker
hook is used to prevent navigation when there are unsaved changes. However, theblocker.proceed?.()
function is called without checking if it exists, which could lead to potential runtime errors ifblocker.proceed
is undefined.
2. skyvern-frontend/src/routes/workflows/editor/FlowRenderer.tsx:437
- Draft comment:
Consider usingawait
withhandleSave()
to ensure the save operation completes before proceeding with navigation. - Reason this comment was not posted:
Confidence changes required:50%
ThehandleSave
function is called without awaiting its promise resolution. This could lead to unexpected behavior if the save operation is not completed before proceeding with navigation.
3. skyvern-frontend/src/routes/workflows/editor/FlowRenderer.tsx:438
- Draft comment:
Consider checking ifblocker.proceed
is defined before calling it to prevent potential runtime errors. - Reason this comment was not posted:
Confidence changes required:50%
TheuseBlocker
hook is used to prevent navigation when there are unsaved changes. However, theblocker.proceed?.()
function is called without checking if it exists, which could lead to potential runtime errors ifblocker.proceed
is undefined.
Workflow ID: wflow_TkuwH2KRoZ8auBpo
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
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.
👍 Looks good to me! Reviewed everything up to c5a8746 in 33 seconds
More details
- Looked at
681
lines of code in4
files - Skipped
0
files when reviewing. - Skipped posting
5
drafted comments based on config settings.
1. skyvern-frontend/src/routes/workflows/editor/FlowRenderer.tsx:414
- Draft comment:
Consider checking ifblocker
is defined before callingblocker.reset?.()
. This will prevent potential runtime errors ifblocker
is undefined. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable:
The use of optional chaining (?.
) in the code already provides a safeguard againstblocker
being undefined. This makes the comment unnecessary as the code is already handling the potential issue. The comment does not suggest a change that is needed, as the code is correct as is.
I might be overlooking a scenario whereblocker
could be undefined before the optional chaining is applied, but the use ofuseBlocker
should ensureblocker
is defined.
The use ofuseBlocker
should ensure thatblocker
is defined, and the optional chaining is a standard way to handle potential undefined values, making the comment unnecessary.
The comment is unnecessary because the code already handles the potential issue with optional chaining. The comment should be deleted.
2. skyvern-frontend/src/routes/workflows/editor/FlowRenderer.tsx:436
- Draft comment:
Consider adding error handling for thehandleSave
function call to manage potential promise rejections. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable:
ThehandleSave
function is already wrapped in a mutation that has anonError
callback, which handles errors by showing a toast message. This indicates that error handling is already implemented. The comment may be redundant as the error handling seems to be adequately addressed.
I might be overlooking a specific scenario where additional error handling could be beneficial, such as handling errors at the point of thehandleSave
call rather than within the mutation itself.
The existing error handling within the mutation'sonError
callback should suffice for managing promise rejections, as it provides user feedback through a toast message.
The comment is unnecessary because error handling is already implemented within the mutation'sonError
callback. The comment should be deleted.
3. skyvern-frontend/src/routes/workflows/editor/FlowRenderer.tsx:215
- Draft comment:
Consider addingnodes
andedges
to the dependency array of thisuseEffect
to ensure it runs when these values change. - Reason this comment was not posted:
Comment was on unchanged code.
4. skyvern-frontend/src/routes/workflows/editor/FlowRenderer.tsx:349
- Draft comment:
Consider consolidating multiplesetHasChanges(true)
calls to reduce unnecessary re-renders. This is applicable in other parts of the code as well. - Reason this comment was not posted:
Confidence changes required:50%
ThesetHasChanges(true)
is called multiple times in the code, which could lead to unnecessary re-renders. It might be beneficial to consolidate these calls.
5. skyvern-frontend/src/store/WorkflowHasChangesStore.ts:10
- Draft comment:
Consider implementing a mechanism to persist thehasChanges
state across sessions to prevent loss of unsaved changes on page refresh. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable:
The comment suggests a potential improvement to the code by adding persistence for thehasChanges
state. This is a valid suggestion as it addresses a potential issue with losing state on page refresh. However, the comment is speculative and not directly related to a bug or error in the current implementation. It is more of a feature suggestion than a necessary code change.
The comment could be seen as a useful suggestion for improving user experience, but it does not point out a flaw or error in the current code. It might not be necessary to address this in the current scope of changes.
While the comment is speculative, it does highlight a potential user experience issue that could be important depending on the application's requirements. However, without knowing the specific requirements, it's hard to justify keeping the comment.
The comment is speculative and suggests a feature rather than addressing a clear issue with the current code. It should be deleted as it does not indicate a necessary code change.
Workflow ID: wflow_LkgC3kRMNFWq7zFp
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
feat: add unsaved changes tracking to workflow editor
Summary:
Add unsaved changes tracking to workflow editor with state management, navigation prompt, and UI components.
Key points:
useWorkflowHasChangesStore
inFlowRenderer.tsx
,WorkflowEditor.tsx
, andWorkflowParametersPanel.tsx
.WorkflowEditor.tsx
andFlowRenderer.tsx
when navigating away with unsaved changes.saveWorkflowMutation
inFlowRenderer.tsx
.WorkflowHasChangesStore.ts
forhasChanges
state management.FlowRenderer.tsx
for node and edge modifications.WorkflowParametersPanel.tsx
for parameter add, edit, and delete.FlowRenderer.tsx
for handling unsaved changes.Generated with ❤️ by ellipsis.dev