Merge pull request #10356 from Apetun/fix-setTab

Update Tabs.jsx to Fix setTab bug
This commit is contained in:
Johnson Cherian 2024-10-04 09:56:10 +05:30 committed by GitHub
commit d5bd75555a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -95,10 +95,11 @@ export const Tabs = function Tabs({
useEffect(() => {
const exposedVariables = {
setTab: async function (id) {
if (id) {
setCurrentTab(id);
setExposedVariable('currentTab', id);
fireEvent('onTabSwitch');
if (id !== undefined) {
const tabId = Number(id);
setCurrentTab(tabId);
setExposedVariable('currentTab', tabId);
fireEvent('onTabSwitch')
}
},
currentTab: currentTab,