Repository navigation
feat: allow user close the tab to sync the draft - #30034
Conversation
Summary of ChangesHello @fatelei, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a critical enhancement to the workflow editor by implementing automatic draft saving when a user closes their browser tab or navigates away. This feature significantly improves data persistence and user experience by ensuring that in-progress work is not lost, leveraging browser lifecycle events to trigger immediate synchronization of any pending changes. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces functionality to automatically save the workflow draft when the user closes the browser tab or switches away from it. This is achieved by adding event listeners for visibilitychange and beforeunload. The changes to the Zustand store to support flushing debounced sync operations are well-implemented. However, I've found a couple of issues in the React component where these new capabilities are used. Specifically, there's a redundant network request being made, and an unreliable method is used for saving data in the beforeunload handler. My review includes suggestions to fix these issues to make the draft saving more robust and efficient.
Important
Fixes #<issue number>.Summary
fix #29411
allow user close the tab to sync the draft
Screenshots
when close the tab, check the dify api server log, call the draft api
Checklist
dev/reformat(backend) andcd web && npx lint-staged(frontend) to appease the lint gods