-
Notifications
You must be signed in to change notification settings - Fork 34
Fixed : added empty states and reset mapping chip after file is re-uploaded (#307) #355
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
Fixed : added empty states and reset mapping chip after file is re-uploaded (#307) #355
Conversation
Summary of ChangesHello @Nirvan-Bobde30, 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 enhances the user experience on the purchase order review page by introducing an empty state display when no purchase orders are present. Additionally, it improves the file upload workflow by ensuring that any previously selected field mappings are cleared upon a new file upload or an upload error, preventing stale data and potential mapping issues. Highlights
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request successfully adds an empty state for the purchase order review page and ensures that the mapping chip state is reset when a new file is uploaded. The changes are logical and address the described issues. I've provided a couple of suggestions in src/views/PurchaseOrder.vue to improve code maintainability by reducing duplication and ensuring consistent state management, particularly in error handling scenarios.
| this.selectedMappingId = ""; | ||
| this.fieldMapping = Object.keys(this.fields).reduce((map, field) => { | ||
| map[field] = ""; | ||
| return map; | ||
| }, {}); |
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.
This logic to reset the mapping state is also present in the ionViewDidEnter lifecycle hook (lines 103-107). To improve maintainability and adhere to the Don't Repeat Yourself (DRY) principle, consider extracting this block of code into a separate method and calling it from both parse and ionViewDidEnter.
For example, you could create a resetMappingState method:
resetMappingState() {
this.selectedMappingId = "";
this.fieldMapping = Object.keys(this.fields).reduce((map, field) => {
map[field] = "";
return map;
}, {});
}Then you can simply call this.resetMappingState(); here and in other places where this logic is needed, like the catch block.
| } | ||
| } catch { | ||
| this.content = [] | ||
| this.selectedMappingId = ""; |
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.
In case of an error during file parsing, it's good practice to reset the entire mapping state for consistency, not just selectedMappingId. This should include resetting fieldMapping as well, similar to the logic in the try block. This ensures the UI is in a clean and predictable state after an error. This also reinforces the benefit of extracting this logic to a shared method.
this.selectedMappingId = "";
this.fieldMapping = Object.keys(this.fields).reduce((map, field) => {
map[field] = "";
return map;
}, {});
Related Issues
#307
Short Description and Why It's Useful
Screenshots of Visual Changes before/after (If There Are Any)
Contribution and Currently Important Rules Acceptance