-
Notifications
You must be signed in to change notification settings - Fork 12
Improved:replaced the ecomstore to productstore(#375) #85
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
base: main
Are you sure you want to change the base?
Conversation
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.
Summary of Changes
Hello @SuyashSingh01, 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 primarily focuses on a refactoring effort to standardize naming conventions across the application. It systematically replaces instances of 'ecomstore' with 'productstore' in various variable and function names. This change aims to improve code clarity and maintainability by ensuring consistent terminology throughout the codebase.
Highlights
- Variable Renaming in App.vue: The local variable
currentEComStorehas been renamed tocurrentProductStoreto align with the new naming convention. - Variable Renaming in User Actions: The variable
ecomStoreshas been renamed toproductStoreswithin the user module's actions for consistency. - Variable Renaming in Utility Actions: The local variable
currentEComStorehas been renamed tocurrentProductStorein the utility module's actions. - Function and Event Renaming in Settings View: The event handler
@updateEComStoreand its corresponding functionupdateEComStorehave been renamed to@updateProductStoreandupdateProductStorerespectively in the Settings view.
Using Gemini Code Assist
The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in pull request comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.
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
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
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 aims to replace ecomstore with productstore for better naming consistency. The changes are mostly variable renames across several files. While the intention is good, I've found a few places where the renaming introduces new inconsistencies, particularly where it interacts with external libraries or other parts of the codebase that were not updated. I've also pointed out several instances where any is used, which undermines the benefits of TypeScript; I've suggested more specific types in those cases. My recommendations focus on improving consistency and type safety.
| const productStores = await useUserStore().getEComStores() | ||
| useUserStore().eComStores = productStores |
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.
There's an inconsistency here. The local variable ecomStores has been renamed to productStores, but it's then assigned to useUserStore().eComStores. This can be confusing for future developers. Since useUserStore and its properties are likely from the @hotwax/dxp-components library and cannot be changed in this PR, it would be more consistent to keep the local variable name as ecomStores to match the property it's being assigned to.
| const productStores = await useUserStore().getEComStores() | |
| useUserStore().eComStores = productStores | |
| const ecomStores = await useUserStore().getEComStores() | |
| useUserStore().eComStores = ecomStores |
| if(userToken.value) { | ||
| const currentEComStore : any = useUserStore().getCurrentEComStore; | ||
| await useProductIdentificationStore().getIdentificationPref(currentEComStore.productStoreId) | ||
| const currentProductStore : any = useUserStore().getCurrentEComStore; |
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.
Using any as a type defeats the purpose of TypeScript and should be avoided. Since currentProductStore is used to access productStoreId on the next line, you can provide a more specific type. Consider defining an interface for the product store object for better type safety and code clarity.
const currentProductStore: { productStoreId: string } = useUserStore().getCurrentEComStore;
| if(!hasError(resp) && resp.data.docs?.length) { | ||
| const currentEComStore = useUserStore()?.getCurrentEComStore as any; | ||
| let fieldName = currentEComStore?.productIdentifierEnumId || "SKU"; | ||
| const currentProductStore = useUserStore()?.getCurrentEComStore as any; |
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.
Casting to any should be avoided as it bypasses TypeScript's type checking. The currentProductStore object is used to access productIdentifierEnumId, so you can provide a more specific type. Also, useUserStore() is a composable that returns a store instance and is unlikely to be nullish, so the optional chaining (?.) may be unnecessary.
| const currentProductStore = useUserStore()?.getCurrentEComStore as any; | |
| const currentProductStore: { productIdentifierEnumId?: string } = useUserStore().getCurrentEComStore; |
| <section> | ||
| <DxpOmsInstanceNavigator /> | ||
| <DxpProductStoreSelector @updateEComStore="updateEComStore" /> | ||
| <DxpProductStoreSelector @updateEComStore="updateProductStore" /> |
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.
There is an inconsistency between the event name @updateEComStore and the handler name updateProductStore. Since DxpProductStoreSelector is an external component from @hotwax/dxp-components, its emitted event names are likely fixed. To improve code clarity and maintainability, the handler function should be named consistently with the event it handles. Consider renaming updateProductStore back to updateEComStore.
<DxpProductStoreSelector @updateEComStore="updateEComStore" />
| } | ||
| async function updateEComStore(selectedProductStore: any) { | ||
| async function updateProductStore(selectedProductStore: any) { |
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 function is a handler for the updateEComStore event, but it's named updateProductStore. This inconsistency can be confusing. It's recommended to rename it to match the event, for example, updateEComStore. Additionally, the parameter selectedProductStore is typed as any. It's better to provide a specific type for it. Since you're accessing productStoreId from it, you could type it as { productStoreId: string }.
async function updateEComStore(selectedProductStore: { productStoreId: string }) {
Related Issues
Issue:dxp-component/375
Issue Link; hotwax/dxp-components#375
Improved:Replaced the Ecomstore to ProductStore at app level
Short Description and Why It's Useful
Screenshots of Visual Changes before/after (If There Are Any)
Contribution and Currently Important Rules Acceptance