fix(changelog): correct variable declarations in populatePackageNames…#671
fix(changelog): correct variable declarations in populatePackageNames…#671vivekv1504 wants to merge 1 commit intowebex:nextfrom
Conversation
|
This pull request is automatically being deployed by Amplify Hosting (learn more). |
| commits.length | ||
| ); | ||
|
|
||
| updateEnhancedComparisonURL(stableA, stableB, selectedPackage, finalVersionA, finalVersionB); |
There was a problem hiding this comment.
Why are we removing this?
There was a problem hiding this comment.
There are two calls to updateEnhancedComparisonURL happening on every comparison
call1 :Line 791 (inside compareAndRenderPackageVersions)
call2:Line 1288 (in the submit handler, right after calling compareAndRenderPackageVersions)
What updateEnhancedComparisonURL does(916):
Each call invokes window.history.pushState(...), which pushes a new entry into the browser's history stack. Since both calls happen with the same URL, you end up with two identical history entries for a single comparison action.
The visible symptom is that if a user clicks the browser's Back button after a comparison, they don't go back to the previous page — instead they stay on the same URL (because the first Back just undoes the duplicate push).
There was a problem hiding this comment.
Thanks for the explanation, Vivek. Do we need this to be done in the SDK as well in that case?
Also today, when I press back button, the URL changes but the UI remains the same.
mkesavan13
left a comment
There was a problem hiding this comment.
Once again, do we need this to be done in the SDK as well?
…function
COMPLETES #< INSERT LINK TO ISSUE >
This pull request addresses
Problem
The
populatePackageNamesfunction had two variables incorrectlydeclared with
constthat were being reassigned, which violatesJavaScript const semantics:
by making the following changes
Code quality improvement: Fix variable declaration issues in the
changelog package selector.
sortedPackages- Assigned different values based on whetherspecial packages exist
optionsHtml- Concatenated with+=operator in a loopSolution
Changed both declarations from
consttoletto allowreassignment.
Impact
Code now follows JavaScript best practices
No functional changes to user experience
Prevents potential bugs from const reassignment
Improves code maintainability
Change Type
The following scenarios were tested
< ENUMERATE TESTS PERFORMED, WHETHER MANUAL OR AUTOMATED >
The GAI Coding Policy And Copyright Annotation Best Practices
Checklist before merging
Make sure to have followed the contributing guidelines before submitting.