Skip to content

Commit

Permalink
fix: safeguard cache control store
Browse files Browse the repository at this point in the history
  • Loading branch information
vobu committed Feb 6, 2022
1 parent 311f62e commit 0949fa0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib/wdi5-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ export function addWdi5Commands() {
const internalKey = wdi5Selector.wdio_ui5_key || _createWdioUI5KeyFromSelector(wdi5Selector)
// either retrieve and cache a UI5 control
// or return a cached version
if (!browser._controls[internalKey] || wdi5Selector.forceSelect /* always retrieve control */) {
if (!browser._controls?.[internalKey] || wdi5Selector.forceSelect /* always retrieve control */) {
Logger.info(`creating internal control with id ${internalKey}`)
const wdi5Control = {}
!browser._controls ? (browser._controls = []) : null
browser._controls[internalKey] = wdi5Control
} else {
Logger.info(`reusing internal control with id ${internalKey}`)
Expand Down

0 comments on commit 0949fa0

Please sign in to comment.