Skip to content

Conversation

@SuyashSingh01
Copy link
Contributor

@SuyashSingh01 SuyashSingh01 commented Sep 18, 2025

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

Copy link

@gemini-code-assist gemini-code-assist bot left a 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 currentEComStore has been renamed to currentProductStore to align with the new naming convention.
  • Variable Renaming in User Actions: The variable ecomStores has been renamed to productStores within the user module's actions for consistency.
  • Variable Renaming in Utility Actions: The local variable currentEComStore has been renamed to currentProductStore in the utility module's actions.
  • Function and Event Renaming in Settings View: The event handler @updateEComStore and its corresponding function updateEComStore have been renamed to @updateProductStore and updateProductStore respectively 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

  1. 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.

Copy link

@gemini-code-assist gemini-code-assist bot left a 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.

Comment on lines +57 to +58
const productStores = await useUserStore().getEComStores()
useUserStore().eComStores = productStores

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

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.

Suggested change
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;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
const currentProductStore = useUserStore()?.getCurrentEComStore as any;
const currentProductStore: { productIdentifierEnumId?: string } = useUserStore().getCurrentEComStore;

<section>
<DxpOmsInstanceNavigator />
<DxpProductStoreSelector @updateEComStore="updateEComStore" />
<DxpProductStoreSelector @updateEComStore="updateProductStore" />

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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 }) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant