Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read properties of undefined (reading '_hideOverride') #2262

Open
amaury14 opened this issue Jan 4, 2024 · 0 comments
Open

Comments

@amaury14
Copy link

amaury14 commented Jan 4, 2024

Summary

When closing a cashmere tab and selecting a tab by the index an error occurs.
TypeError: Cannot read properties of undefined (reading '_hideOverride')

Additional context
File:
healthcatalyst-cashmere.mjs line 19549.

Function:
/** Sets the currently selected tab by either its numerical index or TabComponent object. * Passing a value of -1 or a hidden tab will deselect all tabs in the set. */ selectTab(tab, shouldEmit = true) { this._selectedTab = tab; const activeTab = typeof tab === 'number' ? this._tabs.toArray()[tab] : tab; if (tab === -1 || activeTab._hideOverride) { this.tabContent = null; if (this._routerEnabled) { this._routerDeselected = true; } this._tabs.toArray().forEach(t => t._active = false); if (shouldEmit) { this.selectedTabChange.emit(new TabChangeEvent(-1, null)); } } else { if (this._routerEnabled) { const routeArray = Array.isArray(activeTab.routerLink) ? activeTab.routerLink : [activeTab.routerLink]; this.router.navigate(routeArray, { relativeTo: this.route, queryParams: activeTab.queryParams }); } this._setActive(activeTab, shouldEmit); } }

The error seems to be in this line: if (tab === -1 || activeTab._hideOverride) {
activeTab is undefined.

Original call
this.templateTabSet.selectTab(index, true)

Suggested Fix
Checking the activeTab object before using it or adding ? when calling the _hideOverride property.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant