Open johnsoncherian opened 2 months ago
Hey just wanted to know if im getting this right the function rn is
const exposedVariables = {
setTab: async function (id) {
if (id) {
setCurrentTab(id);
setExposedVariable('currentTab', id);
fireEvent('onTabSwitch');
}
},
currentTab: currentTab,
};
setExposedVariables(exposedVariables);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [setCurrentTab, currentTab]);
the id is being checked and when string is passed its giving a truthy value and when 0 is passed it gives a falsy value
So something like:
if (id !== undefined) { // Check if id is not undefined
const tabId = Number(id); // Convert id to number if it's a string
setCurrentTab(tabId);
setExposedVariable('currentTab', tabId);
fireEvent('onTabSwitch')
Should fix it right?
@Apetun, please ensure the issue is assigned to you before you start working on it. Let me know if you would like me to assign it to you. Once it's assigned, you can create a PR, and we can then evaluate and discuss the best possible solution in the PR discussion.
Ok sure please assign the issue to me.
I would like to work on it.... If this isn't assigned to someone else or not planning to assign to someone else..!!
@Apetun assigned it to you! Happy coding :)
@CuriousCoder00 this issue has been assigned. Can you please check other community issues? Just search for other community contribution
lable
@PriteshKiri Yeah.. I looked at a few issues.. i'd love to work on em
I have made the required changes
Thanks for your contribution @Apetun. Moving the issue to the review
What is the expected behaviour?
In the setTab function should switch to 0th tab regardless of if value is passed as integer 0 or string '0'
What is the current behaviour?
If the tabindex is passed as number type 0 setTab ignore the value and tab is not switched to 0th tab
https://github.com/ToolJet/ToolJet/assets/57667706/942c4a83-77d3-4386-9d3d-f185208a8198