Refactor var to const/let in UI rendering files (3/4)#3302
Merged
Conversation
Migration of `var` declarations to `const`/`let` in 7 files handling UI rendering: view, plan, plan3d, timeline, history, widgets, plugin.template. Also includes incidental fixes that surfaced during the migration: - history.class.js: hoisted `series` out of mutually-exclusive if/else blocks. With `var`, hoisting made it visible after the block (used in addSeries() and chart config). With `const` it would throw "ReferenceError: series is not defined". - plugin.template.js: changed `const eqLogic` to `let eqLogic` in saveEqLogic flow — the variable was reassigned by `eqLogic = saveEqLogic(eqLogic)` and would trigger "TypeError: Assignment to constant variable".
4 tasks
kwizer15
approved these changes
May 2, 2026
Mips2648
approved these changes
May 5, 2026
Salvialf
approved these changes
May 5, 2026
Mips2648
approved these changes
May 5, 2026
kwizer15
approved these changes
May 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Third of four migration PRs splitting #3297 by functional domain. This batch covers 7 files handling UI rendering (views, plans, timeline, history charts, widgets, plugin templates):
Incidental fixes (caught during migration)
history.class.js—var serieswas declared in two mutually-exclusiveif/elseblocks (if (data.result.timelineOnly) { var series = {...} } else { var series = {...} }) but referenced in code located after the block (inaddSeries(series)calls, in chart config object, etc.). Withvar, function-scoped hoisting unified the two declarations and made the reference work. Migrated toconst/let, it became block-scoped and threwReferenceError: series is not defined. Fix: hoisted to a singlelet seriesdeclared before theif/else, with assignments in each branch.plugin.template.js—const eqLogicat line 300 was reassigned at line 311 byeqLogic = saveEqLogic(eqLogic). Changed tolet eqLogicto avoidTypeError: Assignment to constant variableon equipment save flow.Test plan
serieshoist fix)data-optionattributes are populatedeqLogicconst→let fix)Part of the split following #3297 discussion.