Skip to content

Commit 6309815

Browse files
michaeltintiucgrgur
authored andcommitted
Fixes #102 (#104)
1 parent dbaf7d7 commit 6309815

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/components/navigation/ion-tabs.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,15 @@ function parseTabBar(vnode: VNode, tab: string, listeners: EventListeners): VNod
134134
for (const child of vnode.children) {
135135
if (child.tag && child.tag === 'ion-tab-button') {
136136
const clickHandler = (e: Event) => {
137-
const path = (child.elm as HTMLIonTabButtonElement).tab || '/';
137+
const path = (child.elm as HTMLIonTabButtonElement).tab;
138138
const route = hasDataAttr(child, 'to') ? child.data!.attrs!.to : { path };
139139
e.preventDefault();
140140

141+
// Do not trigger any events if there's nowhere to go to
142+
if (!route) {
143+
return;
144+
}
145+
141146
if (Array.isArray(IonTabsWillChange)) {
142147
IonTabsWillChange.map(item => item(route));
143148
} else if (IonTabsWillChange) {

0 commit comments

Comments
 (0)