diff options
| author | Andreas Nedbal <github-bf215181b5140522137b3d4f6b73544a@desu.email> | 2022-05-15 15:20:01 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-15 22:20:01 +0900 |
| commit | d62a55b46f7308ed04971cbfba5572b0d0feea97 (patch) | |
| tree | dcf890637333b410909a13e4a5e8e38198b2aaab /packages/client/src/components | |
| parent | chore: update changelog (diff) | |
| download | sharkey-d62a55b46f7308ed04971cbfba5572b0d0feea97.tar.gz sharkey-d62a55b46f7308ed04971cbfba5572b0d0feea97.tar.bz2 sharkey-d62a55b46f7308ed04971cbfba5572b0d0feea97.zip | |
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>
Diffstat (limited to 'packages/client/src/components')
| -rw-r--r-- | packages/client/src/components/ui/pagination.vue | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/packages/client/src/components/ui/pagination.vue b/packages/client/src/components/ui/pagination.vue index ac6f59c332..9dd18785bc 100644 --- a/packages/client/src/components/ui/pagination.vue +++ b/packages/client/src/components/ui/pagination.vue @@ -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> |