Refactor emoji-edit-dialog to use Composition API (#8657)
* refactor(client): refactor emoji-edit-dialog to use Composition API * fix(client): fix editing emoji not updating emoji list * Apply review suggestions from @Johann150 Co-authored-by: Johann150 <johann@qwertqwefsday.eu> * fix(client): use cached category info instead of making a request * fix(client): use updateItem in emoji pagination when editing * fix(client): reimplement removeItem in MkPagination * Apply review suggestion from @Johann150 Co-authored-by: Johann150 <johann@qwertqwefsday.eu> Co-authored-by: Johann150 <johann@qwertqwefsday.eu>
This commit is contained in:
@ -244,6 +244,11 @@ const append = (item: Item): void => {
|
||||
items.value.push(item);
|
||||
};
|
||||
|
||||
const removeItem = (finder: (item: Item) => boolean) => {
|
||||
const i = items.value.findIndex(finder);
|
||||
items.value.splice(i, 1);
|
||||
};
|
||||
|
||||
const updateItem = (id: Item['id'], replacer: (old: Item) => Item): void => {
|
||||
const i = items.value.findIndex(item => item.id === id);
|
||||
items.value[i] = replacer(items.value[i]);
|
||||
@ -276,6 +281,7 @@ defineExpose({
|
||||
fetchMoreAhead,
|
||||
prepend,
|
||||
append,
|
||||
removeItem,
|
||||
updateItem,
|
||||
});
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user