fix(desktop/js): null guards for dynamic querySelector and missing returns in event handlers (Lot 4)#3327
Open
limad wants to merge 1 commit into
Open
fix(desktop/js): null guards for dynamic querySelector and missing returns in event handlers (Lot 4)#3327limad wants to merge 1 commit into
limad wants to merge 1 commit into
Conversation
…g returns in event handlers (Lot 4) - object.js: fix removeId→id typo in bt_removeObject success callback — dashboard menu links were never cleaned after object deletion - overview.js: guard querySelector before .closest() in updateSummary — MutationObserver could fire with a className not yet in the DOM - types.js: guard eqLogic/cmd querySelector in generic type modal builder and context menu callback — dynamic ids may not match any DOM element - scenario.js: add missing return in .scenario_link handler (fell through to .action_link), and in #bt_cancelElementSave/#bt_crossElementSave (fell through to expressionAttr ctrl-click handler) - backup.js: guard .bt_restoreRepoBackup and .sel_restoreCloudBackup querySelector — repo name from API may have no matching DOM element - replace.js: guard .selectEqReplace querySelector in resetEqlogicSelect - view.js: guard .lg_viewZone querySelector before scrollIntoView - administration.js: guard tab anchor querySelector before reading innerHTML in search result builder
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.
Re-submission of #3325 targeting
developas requested.Changes
object.js — wrong variable name in dashboard cleanup
removeIdis undefined in the success callback; correct variable isid. Dashboard menu links were never cleaned after deleting an object.overview.js — querySelector before .closest() without null guard
updateSummarycalled from MutationObserver — the className may not yet be in the DOM.types.js — querySelector without null guard (×7)
eqLogic[data-id]andcmd[data-id]lookups can return null. Addedif (!el) continue.if (!cmdEl) return.scenario.js — missing return in 3 event handlers
.scenario_link: fell through to.action_link, opening a command config dialog.#bt_cancelElementSave/#bt_crossElementSave: fell through toexpressionAttrctrl-click handler.backup.js — querySelector on dynamic repo name
Both selectors use an API value that may have no matching DOM element.
replace.js — querySelector on dynamic eqlogicId
resetEqlogicSelectparameter may not match any rendered row.view.js — querySelector before scrollIntoView
data-zone_idzone may not be rendered in current view.administration.js — querySelector before .innerHTML in search
Tab anchor lookup can return null. Existing
if (tabName != null)ran after the crash.