svelte-tabs
svelte-tabs copied to clipboard
reactivity on selectedTabIndex not working
Trying to change tabs from outside the Tabs component by changing the selectedTabIndex prop, but it isn't working.
Not sure if the $: variable, anonymous function syntax is legacy, but it doesn't seem to do anything now. I changed it to a function call containing the variable:
on the Tabs.svelte:
$: selectedTabIndex, ()=>{
selectedTab.set(tabs[selectedTabIndex]);
selectedPanel.set(panels[selectedTabIndex]);
};
doesn't work
Changing it to
const setTabAndPanel = (idx) => {
selectedTab.set(tabs[idx]);
selectedPanel.set(panels[idx]);
}
$: setTabAndPanel(selectedTabIndex)
works.
If I can, I'll make a pull request, but it'll be some time.