From 33b4785106846a271efbfe3bcdbd8cda43d728ab Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Tue, 4 Jun 2024 12:17:52 +0300 Subject: [PATCH] add undefined checks --- docs/assets/js/main.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/docs/assets/js/main.js b/docs/assets/js/main.js index 4d819804ed44..9e4880780e91 100644 --- a/docs/assets/js/main.js +++ b/docs/assets/js/main.js @@ -200,8 +200,10 @@ function selectNewExpensify(newExpensifyTab, newExpensifyContent, expensifyClass newExpensifyTab.classList.add('active'); newExpensifyContent.classList.remove('hidden'); - expensifyClassicTab.classList.remove('active'); - expensifyClassicContent.classList.add('hidden'); + if (expensifyClassicTab && expensifyClassicContent) { + expensifyClassicTab.classList.remove('active'); + expensifyClassicContent.classList.add('hidden'); + } window.tocbot.refresh({ ...tocbotOptions, contentSelector: '#new-expensify', @@ -212,8 +214,11 @@ function selectExpensifyClassic(newExpensifyTab, newExpensifyContent, expensifyC expensifyClassicTab.classList.add('active'); expensifyClassicContent.classList.remove('hidden'); - newExpensifyTab.classList.remove('active'); - newExpensifyContent.classList.add('hidden'); + if (newExpensifyTab && newExpensifyContent) { + newExpensifyTab.classList.remove('active'); + newExpensifyContent.classList.add('hidden'); + } + window.tocbot.refresh({ ...tocbotOptions, contentSelector: '#expensify-classic',