fix(tabs): dispatch change event in update/change context methods

This commit is contained in:
metonym 2021-11-18 07:41:02 -08:00
commit 51ede6df8f

View file

@ -46,10 +46,8 @@
content.update((_) => [..._, { ...data, index: _.length }]); content.update((_) => [..._, { ...data, index: _.length }]);
}, },
update: (id) => { update: (id) => {
if (currentIndex !== $tabsById[id].index) { currentIndex = $tabsById[id].index;
currentIndex = $tabsById[id].index; dispatch("change", currentIndex);
dispatch("change", currentIndex);
}
}, },
change: (direction) => { change: (direction) => {
let index = currentIndex + direction; let index = currentIndex + direction;
@ -75,6 +73,7 @@
} }
currentIndex = index; currentIndex = index;
dispatch("change", currentIndex);
}, },
}); });