Implemented: support to serve app on specific version requested by oms#724
Implemented: support to serve app on specific version requested by oms#724ymaheshwari1 wants to merge 1 commit into
Conversation
Summary of ChangesHello @ymaheshwari1, 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 robust mechanism to support serving different versions of the application, primarily driven by requests from an Order Management System (OMS). It enables the application to dynamically adapt its routing based on the version specified in the URL, ensuring users are directed to the correct application instance. This enhancement is crucial for environments requiring parallel deployments of various application versions. 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 support for serving different versions of the application based on the URL path. This is a significant feature, achieved by updating webpack configuration and Vue Router logic. The implementation is mostly on the right track, but there are several areas for improvement. My review focuses on removing debug logs, improving the robustness of URL manipulation, and correcting the webpack and router configuration to ensure stable client-side routing with versioned paths. Addressing these points will make the feature more reliable and maintainable.
| const router = createRouter({ | ||
| history: createWebHistory(process.env.BASE_URL), | ||
| // TODO: check if we need this condition to check for VUE_APP_BUILD value and compare it with appVersion | ||
| history: createWebHistory(appVersion == process.env.VUE_APP_BUILD ? appVersion : process.env.BASE_URL), |
There was a problem hiding this comment.
The logic to determine the history's base path is complex, and the TODO comment indicates it's not finalized. The check appVersion == process.env.VUE_APP_BUILD seems to prevent using older versions of the app, as it would cause the router to use an incorrect base path. The redirection logic in router.beforeEach should be sufficient to handle incorrect versions.
A simpler and more correct approach would be to use appVersion as the base path if it exists. This also depends on the publicPath setting in vue.config.js. If publicPath is correctly set to an absolute path, you can likely just use createWebHistory(process.env.BASE_URL).
| history: createWebHistory(appVersion == process.env.VUE_APP_BUILD ? appVersion : process.env.BASE_URL), | |
| history: createWebHistory(appVersion || process.env.BASE_URL), |
| transpileDependencies: ['@hotwax/dxp-components'] | ||
| transpileDependencies: ['@hotwax/dxp-components'], | ||
| outputDir: `dist/${process.env.VUE_APP_BUILD}`, | ||
| publicPath: process.env.NODE_ENV === "production" ? `./${process.env.VUE_APP_BUILD}` : "/" |
There was a problem hiding this comment.
Using a relative publicPath (starting with ./) is not recommended when using HTML5 history mode for client-side routing. It can cause problems with nested routes and requires specific server configuration to work correctly. It's safer to use an absolute path to avoid ambiguity and ensure routing works as expected.
| publicPath: process.env.NODE_ENV === "production" ? `./${process.env.VUE_APP_BUILD}` : "/" | |
| publicPath: process.env.NODE_ENV === "production" ? `/${process.env.VUE_APP_BUILD}/` : "/" |
Related Issues
Short Description and Why It's Useful
Screenshots of Visual Changes before/after (If There Are Any)
Contribution and Currently Important Rules Acceptance